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
Related
This question already has answers here:
Disable drag of JFrame
(2 answers)
Closed 2 years ago.
For example the game window I made is 600*800, I want to "immobilize" it on the screen?
Make it a full screen window:
JFrame frame = /* ... */;
frame.setUndecorated(true);
GraphicsEnvironment env =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice screen = env.getDefaultScreenDevice();
screen.setFullScreenWindow(frame);
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);
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:
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 an answer here:
Closed 11 years ago.
Possible Duplicate:
How to add scrollbar to panel ?
I'm trying to draw some shapes on a jPanel, once the shapes reach the panel size, the rest of shapes are not visibles.
can I add a scrollbar to the panel in order to see the rest of the shapes?
Sure: wrap your JPanel into a JScrollPane (it takes any Component in its constructor)