I have been trying to set the size of my JFrame to the exact same size of my screen (2256x1504). It also seems to take that size but when I display something the outcome is alw
I have been trying to set the size of my JFrame to the exact same size of my screen (2256x1504).
Don't use magic numbers. Each computer can be using a screen with a different resolution. Let Swing determine the size. Use:
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
So the basic structure of the code would be:
JPanel panel = new JPanel();
add( panel );
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setAlwaysOnTop(true);
setUndecorated(true);
//setResizable(false); // not needed since the title bar is removed
setExtendedState(JFrame.MAXIMIZED_BOTH);
//pack(); // not needed since the frame will be the screen size
setVisible(true);