Full-Screen Problem

Hello all,

I’m having a bit of a problem with full-screen exclusive mode. It properly goes into full-screen but whenever I press Alt-Tab to switch to another window then go back to my full-screen application, it doesn’t go back into full-screen and the application doesn’t show up.

Here’s my code:

import java.awt.*;
import javax.swing.*;

public class Test extends JPanel {
	public Test() {
	}

	public void paintComponent(Graphics g) {
		g.setColor(Color.black);
		g.fillRect(0, 0, 800, 600);

		g.setColor(Color.white);
		g.drawString("This is a fullscreen test.", 100, 100);
	}

	public static void main(String args[]) {
		JFrame w = new JFrame("FullScreen Test");

		w.setSize(800, 600);
		w.setResizable(false);
		w.setUndecorated(true);
		w.setContentPane(new Test());
		w.setDefaultCloseOperation(w.EXIT_ON_CLOSE);

		GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
		gd.setFullScreenWindow(w);

		w.setVisible(true);
	}
}

What am I doing wrong here? Is there any way to fix this?

I remmber in tje beginning there were alt-tab issues. I dont remember if they got resolved…

In general if yo uconitue your rednering loop while not in control of the screen you make DX very unhappy. You might try shutting it off when you get aminimize event and turnign it abck on when you maximize again and see if that helps…

Hmm, does a JFrame have minimize and maximize events? And if so, what are they? I’ll look into it soon.

Hi Jamison, you can use this way, he works!

         GraphicsDevice device;
         device=GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0];
         device.setFullScreenWindow(this);
         device.setDisplayMode(new DisplayMode(1024,768,16,0));

Bye

Memphis,

That works a little better, but now when I press Alt-Tab once, then Alt-Tab back to the application, then if I try Alt-Tabbing again, it doesn’t work.

Im pretty sure there are window events for minimize and maximize

You may have to enable events on your JFrame because AIR JFrames by default have event reporting turned off…

this is off the top of my head but i think minimized/maximized is called “iconified” or something like that

Check out the WindowListener interface.

I made a class that implements WindowListener.

then you
frameName. addWindowListener(WLClassName)

I was using Frame.
You can implement various gamepause flags when iconified and cleanups when its closing.

Ahh okay. Well my computer crashed the last time I tried doing a fullscreen window and when it started back up, I had all kinds of weird problems. So thanks for the help guys, but I don’t think I’ll do fullscreen stuff anymore. That is unless I find a properly working fix.