1
\$\begingroup\$

I am working on an arcade-like game, and so far, I have been using JFrame. All the action occurs in the JFrame basically.

However, I've noticed that a lot of games that you install on a computer don't have a frame. When you play them on Windows, the game covers the entire screen (the start bar disappears and you can't access any other application on your computer).

I'd like to do that for my game. Is it possible to do so with Java? If so, how would I do this?

\$\endgroup\$
1
  • \$\begingroup\$ Google Java full screen application. I believe it still uses a J Frame but in full screen mode. \$\endgroup\$ Commented Sep 15, 2012 at 16:30

2 Answers 2

2
\$\begingroup\$

You can set JFrame to fullscreen with GraphicsDevice.setFullScreenWindow(jframe);. For example:

// Set fullscreen mode with specified resolution
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
device.setFullScreenWindow(frame);
device.setDisplayMode(new DisplayMode(1280, 720, 32, 60)); // 1280x720 32bpp @ 60Hz

Alternatively when you are using OpenGL, both JOGL and LWJGL have their own native window implementations for rendering. With these you don't need JFrame at all.

\$\endgroup\$
0
\$\begingroup\$

You can use an engine like jmonkeyengine. It made with Java and OpenGL

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .