Exemplo n.º 1
0
  private void initUI() {
    setTitle("pfps");
    setSize(800, 600);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    glcanvas_ = new GLCanvas(glcap_);
    glcanvas_.addGLEventListener(this);
    this.getContentPane().add(glcanvas_, BorderLayout.CENTER);
    animator_ = new FPSAnimator(glcanvas_, 60);
    animator_.start();
    glcanvas_.addKeyListener(input_);
    glcanvas_.addMouseMotionListener(input_);

    moveTimer_ =
        new Timer(
            MOVE_TIMER_FREQ,
            new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                onMoveTimer();
              }
            });
    moveTimer_.start();

    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowOpened(WindowEvent e) {
            MyFrame.this.windowOpened(e);
          }
        });
  }