final GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());
final GLCanvas canvas = new GLCanvas();
  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 Frame("Gear Demo");    if (newMode != null) {      frame.setUndecorated(true);    }    final GLCanvas canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities());    canvas.addGLEventListener(new Gears());    canvas.addGLEventListener(new FullscreenWorkaround(initWidth, initHeight));    frame.add(canvas);    frame.setSize(initWidth, initHeight);    animator = new Animator(canvas);    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();  }