This question already has answers here:
Swing: remove focus border from dialogues' buttons
(3 answers)
Closed 9 years ago.
I have a JButton in Java(Swing):
After the click I get this line around the button:
How do I remove these lines?
button.setFocusPainted(false); is the right solution!
Related
This question already has answers here:
Disable JButton focus border
(5 answers)
Closed 4 years ago.
i'm new there. My first issue:
When i start my GUI java swing application in Window Builder, first object is always selected
and when i click anything (button or anything) it's show like it's clicked and i don't want it to show. What command for this?
You should use this:
button.setFocusPainted(false);
java, swing, awt, remove focus from all objects
This question already has answers here:
Highlight one specific row/line in JTextArea
(3 answers)
Closed 8 years ago.
Is there any way to change the background of a specific line of JTextArea?
I found a class that does what I want. Those interested: http://www.camick.com/java/source/LinePainter.java
Thanks.
This question already has answers here:
How to capture a JFrame's close button click event?
(6 answers)
Closed 8 years ago.
How do you add a ActionListener to the close button (not a JButton the button on the top-right)?
See Closing an Application for a discussion on this topic and a couple of solutions.
Basically you need to do two things:
Use the setDefaultCloseOperation(...) of the frame.
Add a WindowListener to the frame
This question already has answers here:
Hovering over JButtons and displaying a message
(3 answers)
Closed 8 years ago.
I would like to find out how I can link a JLabel to a JButton, so that when ever the button is hovered over, a piece of text appears. Sort of like a tool tip, indicating what this button does before it's clicked.
Why ask for something "sort of like a tool tip" when you can use just that, a tool tip? Simply set the JButton's tool tip text via the JComponent setToolTipText(...) method (which JButton inherits) and you're there!
myButton.setToolTipText("Foo");
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to change JFrame Icon
I want to put Logo or some icon on the corner of window in my Java desktop application.
How to do that?
Use setIconImage(ImageIcon) for this.