// For fullscreen, put the following in your code:
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
// You can also set the dimensions of the window like this:
frame.setSize(1920, 1080); // Change to resolution of your screen.
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setUndecorated(true);
frame.setVisible(true);
GraphicsEnvironment graphics =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = graphics.getDefaultScreenDevice();
JFrame frame = new JFrame("Fullscreen");
device.setFullScreenWindow(frame);