summaryrefslogtreecommitdiffstats
path: root/src/demos/fullscreen/JGearsFullscreen.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-06-15 23:05:16 +0000
committerKenneth Russel <[email protected]>2009-06-15 23:05:16 +0000
commit935d2596c13371bb745d921dbcb9f05b0c11a010 (patch)
tree7fcc310618ae5a90edc734dc821e75afc0f080aa /src/demos/fullscreen/JGearsFullscreen.java
parente2332d2f2908e68f1e77454c73f329f8ff2b400d (diff)
Deleted obsolete source code in preparation for copying JOGL_2_SANDBOX
on to trunk git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/trunk@351 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/fullscreen/JGearsFullscreen.java')
-rwxr-xr-xsrc/demos/fullscreen/JGearsFullscreen.java145
1 files changed, 0 insertions, 145 deletions
diff --git a/src/demos/fullscreen/JGearsFullscreen.java b/src/demos/fullscreen/JGearsFullscreen.java
deleted file mode 100755
index 465c566..0000000
--- a/src/demos/fullscreen/JGearsFullscreen.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package demos.fullscreen;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import javax.media.opengl.*;
-import com.sun.opengl.util.*;
-import demos.jgears.JGears;
-import demos.util.*;
-
-/**
- * JGearsFullscreen.java <BR>
- * author: Brian Paul (converted to Java by Ron Cemer and Sven Goethel) <P>
- *
- * This version is equal to Brian Paul's version 1.2 1999/10/21 <P>
- *
- * Illustrates usage of GLJPanel in full-screen mode. On Windows this
- * demo should be run with the system property
- * -Dsun.java2d.noddraw=true specified to prevent Java2D from using
- * DirectDraw, which is incompatible with OpenGL at the driver level.
- */
-
-public class JGearsFullscreen {
- private GraphicsDevice dev;
- private DisplayMode origMode;
- private boolean fullScreen;
- private JFrame frame;
- private Animator animator;
- private int initWidth = 300;
- private int initHeight = 300;
-
- public static void main(String[] args) {
- new JGearsFullscreen().run(args);
- }
-
- public void run(String[] args) {
- dev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
- origMode = dev.getDisplayMode();
- DisplayMode newMode = null;
-
- if (dev.isFullScreenSupported()) {
- newMode = ScreenResSelector.showSelectionDialog();
- if (newMode != null) {
- initWidth = newMode.getWidth();
- initHeight = newMode.getHeight();
- }
- } else {
- System.err.println("NOTE: full-screen mode not supported; running in window instead");
- }
-
- frame = new JFrame("Gear Demo");
- if (newMode != null) {
- frame.setUndecorated(true);
- }
- GLJPanel drawable = new JGears();
- drawable.addGLEventListener(new FullscreenWorkaround(initWidth, initHeight));
-
- frame.getContentPane().setLayout(new BorderLayout());
-
- JButton button = new JButton("West");
- button.setToolTipText("West ToolTip");
- frame.getContentPane().add(button, BorderLayout.WEST);
-
- button = new JButton("East");
- button.setToolTipText("East ToolTip");
- frame.getContentPane().add(button, BorderLayout.EAST);
-
- button = new JButton("North");
- button.setToolTipText("North ToolTip");
- frame.getContentPane().add(button, BorderLayout.NORTH);
-
- button = new JButton("South");
- button.setToolTipText("South ToolTip");
- frame.getContentPane().add(button, BorderLayout.SOUTH);
-
- frame.getContentPane().add(drawable, BorderLayout.CENTER);
- frame.setSize(initWidth, initHeight);
- animator = new Animator(drawable);
- frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- runExit();
- }
- });
- frame.setVisible(true);
-
- if (dev.isFullScreenSupported() && (newMode != null)) {
- dev.setFullScreenWindow(frame);
- if (dev.isDisplayChangeSupported()) {
- dev.setDisplayMode(newMode);
- fullScreen = true;
- } else {
- // Not much point in having a full-screen window in this case
- dev.setFullScreenWindow(null);
- final Frame f2 = frame;
- try {
- EventQueue.invokeAndWait(new Runnable() {
- public void run() {
- f2.setVisible(false);
- f2.setUndecorated(false);
- f2.setVisible(true);
- f2.setSize(initWidth, initHeight);
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.err.println("NOTE: was not able to change display mode; full-screen disabled");
- }
- }
-
- animator.start();
- }
-
- public void runExit() {
- // Run this on another thread than the AWT event queue to
- // make sure the call to Animator.stop() completes before
- // exiting
- new Thread(new Runnable() {
- public void run() {
- animator.stop();
- try {
- EventQueue.invokeAndWait(new Runnable() {
- public void run() {
- if (fullScreen) {
- try {
- dev.setDisplayMode(origMode);
- } catch (Exception e1) {
- }
- try {
- dev.setFullScreenWindow(null);
- } catch (Exception e2) {
- }
- fullScreen = false;
- }
- }
- });
- } catch (Exception e) {
- e.printStackTrace();
- }
- System.exit(0);
- }
- }).start();
- }
-}