This question already has answers here:
Putting button on top of image in JPanel?
(3 answers)
how can i put a JButton on an image?
(4 answers)
Closed 5 years ago.
I'm trying to put a button on top of an image, but it's not working.
GridLayout frame = new GridLayout();
setLayout (frame);
panelOne.add(background);
btn.setLocation (200, 200);
panelOne.add(btn);
add(panelOne);
Related
This question already has an answer here:
How to change text color of a JButton
(1 answer)
Closed 7 years ago.
I have a JButton object: JButton button;
I add text onto it using: button.setText("XYZ");
However, I want to set a particular color to the text. How do I do it?
button.setForeground( Color.RED );
All Swing components support this method.
This question already has answers here:
Remove default JFrame icon
(4 answers)
Closed 8 years ago.
How would I set the icon of a JFrame to be translucent/blank? I just don't want an icon.
JFrame frame = new JFrame();
frame.setIcon();
Set the opacity of jframe
JFrame testFrame=new JFrame ();
testFrame.setUndecorated(true); // Frame is required to set undecorated for changing shape and transparency
testFrame.setOpacity(0.3f);
Details in http://java-swings.blogspot.com/2014/09/java-swings-working-with-jframe.html
This question already has answers here:
How do I change JPanel inside a JFrame on the fly?
(14 answers)
Clear components of JFrame and add new components
(2 answers)
Closed 8 years ago.
I am working on a 15 puzzle.
I need to change the JPanel in the JFrame for a new game.
The reason is that some games have 16 buttons while others have 9 or 25. Sometimes the buttons have a number, but sometimes they have pieces of a picture.
I would like to set up my JPanel, then set it into the JFrame.
The only way that I have been able to achieve this so far is to create a new JFrame, but that outputs a new window.
Is it possible to change the JPanel in the JFrame in 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!
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.