Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Choedan Kal

[java] Fullscreen applets?

This topic is 5280 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone! I am currently learning java, and I would like to know if I there is a way to make applets run in fullscreen? - Choedan Kal

Share this post


Link to post
Share on other sites
Advertisement
You could use a very big applet and use javascript to make your window fullscreen. But I would reccommend using a JFrame and maximizing it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Well, I dont know any javascript, so that is out of the question.

Can I change the screen resolution if I use a JFrame? I am under the impression that I cant, and if I am right, I do have a problem...

- Choedan Kal

Share this post


Link to post
Share on other sites
Try the following, I hope that helps...

import java.applet.Applet;
import java.awt.*;

public class Fullscreen extends Applet
{

private static GraphicsEnvironment env;
private static GraphicsDevice device;
private static GraphicsConfiguration gc;
private static DisplayMode mode;
private static Frame frame;

public static void main(String[] args)
{
env = GraphicsEnvironment.getLocalGraphicsEnvironment();
device = env.getDefaultScreenDevice();
gc = device.getDefaultConfiguration();
mode = device.getDisplayMode();

Fullscreen applet = new Fullscreen

frame = new Frame("Frame!");

applet.setSize(mode.getWidth(),mode.getHeight());
applet.init();
applet.start();

frame.setBackground(Color.black);
frame.dispose();
frame.setResizable(false);
frame.setUndecorated(true);
frame.add(applet);
frame.pack();
frame.setVisible(true);

device.setFullScreenWindow(frame);
}

}

- Gom Jabbar

[edited by - Gom Jabbar on March 5, 2004 5:27:40 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!