• Advertisement

Archived

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

[java] Fullscreen applets?

This topic is 5101 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
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