Example #1
0
  /** The entry main() method */
  public static void main(String[] args) {
    // Create the OpenGL rendering canvas
    GLCanvas canvas = new GLCanvas(); // heavy-weight GLCanvas
    canvas.setPreferredSize(new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));
    JOGL2Nehe09Stars renderer = new JOGL2Nehe09Stars();
    canvas.addGLEventListener(renderer);

    // For Handling KeyEvents
    canvas.addKeyListener(renderer);
    canvas.setFocusable(true);
    canvas.requestFocus();

    // Create a animator that drives canvas' display() at the specified FPS.
    final FPSAnimator animator = new FPSAnimator(canvas, FPS, true);

    // Create the top-level container frame
    final JFrame frame = new JFrame(); // Swing's JFrame or AWT's Frame
    frame.getContentPane().add(canvas);
    frame.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            // Use a dedicate thread to run the stop() to ensure that the
            // animator stops before program exits.
            new Thread() {
              @Override
              public void run() {
                animator.stop(); // stop the animator loop
                System.exit(0);
              }
            }.start();
          }
        });
    frame.setTitle(TITLE);
    frame.pack();
    frame.setVisible(true);
    animator.start(); // start the animation loop
  }
Example #2
0
 private void editButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_editButtonActionPerformed
   // TODO add your handling code here:
   JFrame EditUserQuery = new EditUserQuery();
   EditUserQuery.setVisible(true);
 } // GEN-LAST:event_editButtonActionPerformed