Questions tagged as 'swing'

1
answer

How to capture the colors of a Label that is behind another label?

I have two JLabels overlapping each other. JLabel label = new JLabel(); label.setBounds(15, 15, 300, 300); label.setOpaque(true); label.setBackground(Color.red); JLabel label1 = new JLabel(); label1.setBounds(60, 60, 300, 300); label1.setOpaq...
asked by 05.04.2017 / 22:35
2
answers

How to create a shortcut to open a JMenu?

Talk, people know how to create a keyboard shortcuts method to open a JMenu . For example, click F1 or CTRL + "something" and open a screen.     
asked by 31.10.2016 / 00:43
2
answers

Button locked in while

My program has a loop, created with the command while . I start the loop with the start button. However, I can not do anything else in the program while while is running. I wanted to put a button called Stop that pressed on it...
asked by 05.05.2017 / 04:14
1
answer

How to add MouseClicked to a JLabel?

I'm creating a program with MVC rules in Java and would like to know how to create an Event in a JLabel when I click on it with the mouse. For example, for buttons I do this: View class: void addLogarListener(ActionListener cal) {...
asked by 21.11.2016 / 14:23
1
answer

Get selected object id attribute in JComboBox

I have a table in the DB with Id Columns, Number Plate, and Drill on the board. I would like to show in the JComboBox the concatenation of "Plate N ° + Drilling". Example:    Plate 10 - 113.00 mm But when a combobox item is s...
asked by 28.11.2016 / 20:04
1
answer

Creating JLabels Dynamically

I have to create, from a click of a button, a JLabel dynamically. So that these labels are arranged in an order, giving a name for this JLabel . The user can create as many labels as he wants ... How do I do this? In my ac...
asked by 04.07.2016 / 14:52
1
answer

How to change the color of a JMenuBar?

Is there any way to change the background and foreground color of the java menu bar? I looked in various forums and tutorials and could not find a way to change the color of the menu bar. Here's an example: public class menu extends java...
asked by 26.08.2016 / 22:30
1
answer

Search using JTextField and JTable

I am having a question about searching a JTable using JTextField. When the person enters the name of the Work in Textfield and click on search, in the JTable is to appear the search result. Myquestionisthis:HowdoIcleanJTableandfillitoutwitht...
asked by 12.06.2016 / 04:04
1
answer

How to create a dynamic JTable?

I have a JTable in my form, I wanted the size (number of rows and columns) of the table to be according to the number that the user type, how to do in java?     
asked by 04.06.2016 / 02:36
1
answer

How do I initialize the centralized JFrame?

I have tried this.setLocationRelativeTo(null); only that he was not in the middle of the screen, I would say he was much more right and down than in the center. public Principal() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.s...
asked by 25.03.2016 / 02:06