Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Full-Screen Problem  (Read 1487 times)
0 Members and 1 Guest are viewing this topic.
Offline Jamison

Junior Devvie




We're all idiots in one way or another.


« Posted 2006-04-21 22:02:58 »

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:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
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 don't like you. Check out my site Smiley www.gamedevforums.com
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2006-04-21 23:13:30 »

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...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jamison

Junior Devvie




We're all idiots in one way or another.


« Reply #2 - Posted 2006-04-21 23:36:40 »

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

I don't like you. Check out my site Smiley www.gamedevforums.com
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Memphis

Innocent Bystander





« Reply #3 - Posted 2006-04-22 16:04:40 »

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
Offline Jamison

Junior Devvie




We're all idiots in one way or another.


« Reply #4 - Posted 2006-04-22 17:59:16 »

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.

I don't like you. Check out my site Smiley www.gamedevforums.com
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2006-04-23 18:39:47 »

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

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...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline woogley
« Reply #6 - Posted 2006-04-23 19:24:55 »

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

Junior Devvie





« Reply #7 - Posted 2006-04-23 19:59:54 »

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.
Offline Jamison

Junior Devvie




We're all idiots in one way or another.


« Reply #8 - Posted 2006-04-23 22:24:57 »

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.

I don't like you. Check out my site Smiley www.gamedevforums.com
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (57 views)
2014-11-26 15:22:04

toopeicgaming1999 (51 views)
2014-11-26 15:20:36

toopeicgaming1999 (10 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (27 views)
2014-11-25 11:26:43

Gibbo3771 (24 views)
2014-11-24 19:59:16

trollwarrior1 (37 views)
2014-11-22 12:13:56

xFryIx (75 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!