Questions tagged as 'swing'

1
answer

Access JLabels without using switch ... case

I'm developing a game with JLabel 1 to 50, I can access them in line of code without having to use a switch. You can verify that what changes in the code and only lblBoard1 or lblBoard2 and so on, who will determine JL...
asked by 04.02.2018 / 07:39
1
answer

How to change the color of a button?

I'm doing some experiments to get a better understanding of Netbeans IDE and I had this doubt about the color of a button. By right-clicking on any jButton and selecting Properties, I set the background item to green, for example, but only...
asked by 31.12.2017 / 15:45
1
answer

Positioning Labels

I'm having trouble adding labels to different positions, relative to a field (% with%). I'd like to put a JTextField before the field, the left, and a second label below the label . Example: Itriedtousesomelayoutmanagers,...
asked by 02.12.2017 / 15:30
1
answer

Error when trying to put JCheckBox in a JTable column

I'm trying to add a column to a DefaultTableModel , but it seems to be giving some problems. Follow the code! JCheckBox jcheck; DefaultTableModel modelo = new DefaultTableModel(null, new String[]{"Data", "Hora", "SAP", "BPCS", "Etiqueta"...
asked by 14.11.2017 / 12:29
1
answer

Identify JRadioButton selection

I created a java code with 2 JRadioButtons and I need it to appear on the console which radio is selected, and when I change the radio, it will appear on the console as well. I've already tried using if(rad1.isSelected()){"Argumentos"} an...
asked by 22.10.2017 / 16:47
1
answer

Error to popular jtable with database

I have to make a client registration application in JAVA, I'm using eclipse. The problem is in the listarCli() method, because when I comment on this method the error does not appear. The error is: "java.lang.NullPointerException" Acco...
asked by 15.09.2017 / 18:31
1
answer

Check if you have reached the last row of the table

I am using this code to do an approved or disapproved check, but when it arrives on the last line, it is not checking if it is on the last line and does not give me the result. I would like to know how to check if you have reached the last...
asked by 03.10.2017 / 03:44
1
answer

get and set value of a JDateChooser

I've created a JDateChooser propio, so I can make more custom changes to it later. The problem, is that I realized, that if I choose a date on it, it just moves me to the current date. For example, if I choose 1990 or 2020, it will ret...
asked by 02.09.2017 / 21:08
1
answer

Creating dynamic JTextPane component

I had a problem with editing labels , which was fixed using JTextPane . So I thought of creating my own component of this type, so I can pass values "dynamically", and writing a few lines, making it more object - oriented. However,...
asked by 06.08.2017 / 19:37
1
answer

How to know the size of JFrame in the constructor of the same?

I need to adjust the size of the image to the space provided by jframe . Error: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) must be non-zero at java.awt.image.ReplicateScale...
asked by 28.08.2017 / 13:05