Skip to main content

Questions tagged [swing]

Swing is a user-interface toolkit in Java and is shipped with the standard Java SDK. It is contained within the package javax.swing.

swing
0 votes
1 answer
100 views

Java application keeps using the wrong database, even though I specified which one to use

I was working on a college project for a Java application which uses the Swing library. Everything seemed to be going really well, but suddenly, when I used git on my university's notebook to pull the ...
Samuel Francisco's user avatar
0 votes
0 answers
77 views

How to acquire JButton's enabled state at runtime from another class

I have multiple forms containing multiple textFields and a save JButton each. When I create each of these fields, i pass the form's save button to the associated InputVerifiers which are supposed to ...
Dia Sheikh's user avatar
0 votes
1 answer
34 views

JFileChooser title icon not changing

I have seen answers saying that the icon is taken from the parent, but it is not working for me. I have a JDialog class where I set the Icon: this.setIconImage(Toolkit.getDefaultToolkit().getImage(...
tumorito's user avatar
0 votes
0 answers
26 views

Get Foreign Key id of a table and make a list of the object ids assigned to it in a JComboBox

I want to the admin user to select an Id from a MySql database table and show an id list of the other columns that are assigned to the original Id that the person selected in a JComboBox and ...
Iann Schmith's user avatar
1 vote
0 answers
43 views

Starting X and sometimes Y coordinate of JFrame is displaced

Just recently started playing around more with Swing and right now I am trying to build an Algorythm Visualiser. The array being displayed is displaced. The starting X coordinate is shifted to the ...
domk's user avatar
  • 19
0 votes
0 answers
40 views

Textfield Sometimes Highlighted When getFocusInWindow() Called

I have a vertical BoxLayout with a few JTextfields. Whenever one of the fields is edited, I would like the field to come to the top: I do this by removing the field and re-adding it to the top. ...
Henry Copper's user avatar
0 votes
0 answers
26 views

Draggable nodes in JTree

This is the TransferHandler code I found here. JTree is completely draggable, but the problem is that when I move one of the nodes, in the place where I put that node, two nodes are added instead of ...
BaRiBoD's user avatar
1 vote
1 answer
63 views

How can I stop keyPressed from repeatedly being called?

When I press an arrow key, keyPressed is called once, and then after a delay it is called very rapidly, like when holding down a key to type a long string of letters like so: eeeeeeeeeeeeeeeeeeeeeee ...
BobTheDragon's user avatar
0 votes
0 answers
101 views

graalvm swing program in linux cannot switch to Chinese input methods in the JTextField component

# my graalvm version export GRAALVM_HOME=/home/mxh/software/graalvm-jdk-21.0.3+7.1 export JAVA_HOME=/home/mxh/software/graalvm-jdk-21.0.3+7.1 export PATH=$JAVA_HOME/bin:$PATH export GRAALVM_HOME # my ...
刘梦丹's user avatar
0 votes
0 answers
44 views

Can not Change width of textField in Java Swing

I am using Dimension(width, height) to manipulate the height and width , but only the height is changing, not the width. I tried the following - cal = new JTextField("0"){ @Override ...
Amatul Uzma's user avatar
1 vote
1 answer
70 views

Graphics2d on JPanel

I want to make a program in Java that drops a square at the position of your mouse. For that I wanted to draw a grid as background and then add the squares but as soon as I add a new component to the ...
Wurstbrot's user avatar
0 votes
0 answers
18 views

Could not find or load main class GUI error in Java Swing [duplicate]

import javax.swing.JFrame; public class GUI { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(600, 500); frame.setVisible(true); frame....
JOEMARI MEDIAVILLA's user avatar
0 votes
0 answers
28 views

JPanel and Grid Layout modification

I have been trying to modify the contents of a gridlayouts in a panel i created(Java by the way Ecliplse), but no method ive tried is working this is the code: // Planning to add about 6 more buttons ...
tomi bell's user avatar
0 votes
1 answer
43 views

Rotating Image Going Out of Visible Bounds When Using Affine Transformation [closed]

I am rotating an image using the Affine Transformation to create a pendulum that moves back and forth. When the image is rotated to the left, it goes outside of the visible bounds and disappears. How ...
341069300's user avatar
0 votes
0 answers
30 views

Cannot import javax.swing in Eclipse [duplicate]

Here's the code. It said the package javax.swing is not accessible and jOptionPane cannot be resolved. import javax.swing.jOptionPane; public class GUI { public static void main(String[] args) { ...
tranvu24's user avatar

15 30 50 per page
1
3 4
5
6 7
5426