1 year ago
#380047
eattato
JPanel always become full screen size if its inside of full screen JFrame
When I add JPanel into full screen JFrame, JPanel sizing does not work and JPanel becomes full screen too, whats problem here and how to fix?
import java.awt.*;
import javax.swing.*;
public class pcb extends JFrame {
public static void main(String[] args) {
JFrame pcb = new JFrame();
pcb.setUndecorated(true);
pcb.setBackground(new Color(0, 0, 0, 0)); // transparent jframe
pcb.setExtendedState(JFrame.MAXIMIZED_BOTH); // full size
JPanel timerFrame = new JPanel();
timerFrame.setLayout(null);
timerFrame.setSize(350, 200);
timerFrame.setBackground(new Color(100, 150, 100, 255));
timerFrame.setVisible(true);
pcb.add(timerFrame);
pcb.setVisible(true);
}
}
java
swing
jframe
jpanel
fullscreen
0 Answers
Your Answer