예제 #1
0
  /** @see pong.ApplicationState#stop() */
  @Override
  public void stop() {
    Debugger.debugWriteln("Stopping main menu.", this.getClass());

    mainFrame.dispose();
    mainFrame = null;
  }
예제 #2
0
  /** @see pong.ApplicationState#init() */
  @Override
  public void init() {
    JFrame.setDefaultLookAndFeelDecorated(false);

    // Set background scene.

    backgroundScene =
        new PhysicsScene(CollidableMap.getMainMenuMap(), null, null, .0f, new RandomBallStrategy());

    // Create GUI.
    mainFrame = new PongFrame("Pong Adventures -Main menu-", backgroundScene, false, null, false);
    mainFrame.addWindowListener(this);
    mainFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    mainFrame.setResizable(false);

    // Setting frame to center of screen.
    Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
    mainFrame.setBounds(
        center.x - Global.windowSize.width / 2,
        center.y - Global.windowSize.height / 2,
        Global.windowSize.width,
        Global.windowSize.height);

    newGameButton = new JButton("New Game");
    newGameButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    newGameButton.addActionListener(this);

    settingsButton = new JButton("Settings");
    settingsButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    settingsButton.addActionListener(this);

    exitButton = new JButton("Exit");
    exitButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    exitButton.addActionListener(this);

    Container content = mainFrame.getContentPane();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

    content.add(Box.createGlue());
    content.add(Box.createGlue());
    content.add(newGameButton);
    content.add(Box.createGlue());
    content.add(settingsButton);
    content.add(Box.createGlue());
    content.add(exitButton);
    content.add(Box.createGlue());
    content.add(Box.createGlue());

    mainFrame.setVisible(true);

    Debugger.debugWriteln("Initializing main menu.", this.getClass());
  }
예제 #3
0
 private Address bigIntToAddress(BigInteger i) {
   String s = bigIntToHexString(i);
   return debugger.parseAddress(s);
 }