Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Using java web start, using jre 1.5, my java app runs fullscreen, exact same code with jrk 1.6 it won't, does windowed instead

Posted on 2007-10-21
8
Medium Priority
?
906 Views
Last Modified: 2013-12-29
My java app won't run fullscreen with jre 1.6 even though same code runs fullscreen with java 1.5. I am launching with java web start.
I have both 1.5 and 1.6 jre's installed on my computer
In my php generated jnlp file, with version set to 1.5+ or 1.6
  <resources>
    <j2se version="1.6"/>
it runs windowed.
with version set to 1.5
  <resources>
    <j2se version="1.5"/>
it has no problem running fullscreen.

Here is my java code that attempts to set fullscreen mode:
            
            out("Getting local Graphics Environment...");
            GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
            out("Getting default screen device...");
            device = env.getDefaultScreenDevice();
            out("Getting default configuration...");
            graphicsConfig = device.getDefaultConfiguration();
            /* Make sure full screen mode is supported by this device */
            if (screenMode == FULLSCREEN)
            {
                  out("screenMode is fullScreen so attempting to run full screen, otherwise will run in windowed mode...");
                  // Save user display mode to restore to upon exit.
                  // Hook, not sure if this is working
                  out("Getting display mode...");
                  originalDisplayMode = device.getDisplayMode();
                  
                  out("Checking if device.isFullScreenSupported...");
                  if (!device.isFullScreenSupported())
                  {
                        screenMode = WINDOWED;
                        out("Fullscreen mode is not supported, continuing in windowed mode.");
                  }
            }
            /* don't go to fullscreen for debugging */
            if (screenMode == FULLSCREEN)
            {
                  out("Setting full screen mode...");
                  frame = new Frame(graphicsConfig);
                  frame.setUndecorated(true);

                  try
                  {
                        device.setFullScreenWindow((Frame)frame);
                  } catch (Exception e)
                  {
                        e.printStackTrace();
                  }
                  out("Full screen mode now set.");
                  if (device.isDisplayChangeSupported()) {
                        DisplayMode dm = new DisplayMode(WIDTH, HEIGHT, 32, 0);
                        if (isDisplayModeAvailable(dm, device))
                        {
                              out("Setting display mode..." + dm.toString());
                              device.setDisplayMode(dm);
                        } else
                        {
                              out("Requested display mode is not available: Height: "
                                          + dm.getHeight() + " Width: " + dm.getWidth() + " Bit depth: "
                                          + dm.getBitDepth());
                        }
                  } else
                  {
                        out("Display change not supported");
                  }
            }

Here is java console output when running with java 1.5, despite the security access exception, it still runs fullscreen:

RGInfo.sysout: screenMode is fullScreen so attempting to run full screen, otherwise will run in windowed mode...
RGInfo.sysout: Getting display mode...
RGInfo.sysout: Checking if device.isFullScreenSupported...
RGInfo.sysout: Setting full screen mode...
java.security.AccessControlException: access denied (java.awt.AWTPermission fullScreenExclusive)
      at java.security.AccessControlContext.checkPermission(Unknown Source)
      at java.security.AccessController.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkPermission(Unknown Source)
      at sun.awt.Win32GraphicsDevice.setFullScreenWindow(Unknown Source)
      at system.Rainglen.init(Rainglen.java:310)
      at demostory.RGDemoStory.init(RGDemoStory.java:104)
      at system.Rainglen.run(Rainglen.java:438)
      at demostory.RGDemoStory.main(RGDemoStory.java:70)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
RGInfo.sysout: Full screen mode now set.

Here is java console output when running with java 1.6:

RGInfo.sysout: Getting local Graphics Environment...
RGInfo.sysout: Getting default screen device...
RGInfo.sysout: Getting default configuration...
RGInfo.sysout: screenMode is fullScreen so attempting to run full screen, otherwise will run in windowed mode...
RGInfo.sysout: Getting display mode...
RGInfo.sysout: Checking if device.isFullScreenSupported...
RGInfo.sysout: Fullscreen mode is not supported, continuing in windowed mode.
RGInfo.sysout: Running in windowed mode...

my jars are signed.

Solution to running fullscreen under java 1.6 will be very much appreciated, my app has significant benefits being fullscreen, most notably, kids can't play around on the desktop. :)
0
Comment
Question by:rainglen
  • 5
  • 2
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20119243
What about the console output in 1.6?

Incidentally if you're getting security exceptions, then one of more jars has not been signed properly
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20119280
>>What about the console output in 1.6?

Forget that sorry - i see it. Is it possible for us to try this? I'm running 1.6
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20119323
>>when running with java 1.5, despite the security access exception, it still runs fullscreen:

Can you get any other window to overlap it when it does?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 400 total points
ID: 20119353
FYI, your 'Story Demo using Java Web Start' runs without error on my machine in a maximized window (full screen not supported)
0
 
LVL 92

Accepted Solution

by:
objects earned 1600 total points
ID: 20119534
make sure u have granted security rights in your jnlp
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1600 total points
ID: 20119537
 <security>
      <all-permissions/>
  </security>
0
 

Author Comment

by:rainglen
ID: 20119889
Thanks guys, the security permissions did it. I had a mental note to try that, and forgot about it. The permissions solved it and as an added bonus, it got rid of the security access exception when running under 1.5 as well. I had to assign points to CEHJ for going to the trouble of running it!

I am quite happy to have that solved, now on to see about running under Vista, would help if I actually had Vista... :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20121192
:-)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question