Removing lines around button after it's clicked in Swing [duplicate] - java

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

Java swing easy one but I don't know it [duplicate]

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

Change background of a specific line of JTextArea [duplicate]

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.

How to add a ActionListener to the close button [duplicate]

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

How do I get a JLabel linked to a JButton? [duplicate]

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");

Inserting logo in the corner of JFrame [duplicate]

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.

Categories

Resources