Search in sources :

Example 1 with GameStatisticsFrame

use of soc.client.stats.GameStatisticsFrame in project JSettlers2 by jdmonin.

the class SOCBuildingPanel method actionPerformed.

/**
 * Handle button clicks in this panel.
 *
 * @param e button click event
 */
public void actionPerformed(ActionEvent e) {
    try {
        String target = e.getActionCommand();
        SOCGame game = pi.getGame();
        if (e.getSource() == gameOptsBut) {
            if ((ngof != null) && ngof.isVisible()) {
                // method override also requests topmost/focus
                ngof.setVisible(true);
            } else {
                ngof = NewGameOptionsFrame.createAndShow(pi, pi.getGameDisplay(), game.getName(), game.getGameOptions(), false, true);
                // drop ngof reference when window is closed
                ngof.addWindowListener(this);
            }
            return;
        }
        if (e.getSource() == statsBut) {
            if (statsFrame != null)
                statsFrame.dispose();
            GameStatisticsFrame f = new GameStatisticsFrame(pi);
            f.register(pi.getGameStats());
            f.setLocation(this.getLocationOnScreen());
            f.setVisible(true);
            statsFrame = f;
            return;
        } else if (e.getSource() == wondersBut) {
            final SOCSpecialItemDialog dia = new SOCSpecialItemDialog(pi, SOCGameOption.K_SC_WOND);
            dia.setNonBlockingDialogDismissListener(pi);
            pi.nbdForEvent = dia;
            dia.pack();
            // is modal but other players' gameplay can continue (separate threads)
            dia.setVisible(true);
            return;
        }
        if (player != null) {
            clickBuildingButton(game, target, false);
        }
    } catch (Throwable th) {
        pi.chatPrintStackTrace(th);
    }
}
Also used : GameStatisticsFrame(soc.client.stats.GameStatisticsFrame) SOCGame(soc.game.SOCGame)

Aggregations

GameStatisticsFrame (soc.client.stats.GameStatisticsFrame)1 SOCGame (soc.game.SOCGame)1