private void okButtonPressed() { if (localSettingsTab.areSettingsValid() == false) { JOptionPane.showMessageDialog(this, Language.getString("fill_names")); // $NON-NLS-1$ return; } try { Settings.addPlayerName(localSettingsTab.getPlayerName(PlayerColor.WHITE), PlayerColor.WHITE); Settings.addPlayerName(localSettingsTab.getPlayerName(PlayerColor.BLACK), PlayerColor.BLACK); Settings.addPlayerName(localSettingsTab.getPlayerName(PlayerColor.RED), PlayerColor.RED); GameTab newGUI = JChessView.getInstance() .addNewTab( MessageFormat.format( "{0} vs {1} vs {2}", localSettingsTab.getPlayerName(PlayerColor.WHITE), localSettingsTab.getPlayerName(PlayerColor.RED), localSettingsTab.getPlayerName(PlayerColor.BLACK))); if (localSettingsTab.isTimeLimitSet()) // if timeGame is checked { Settings.setTimeLimitSet(true); try { Settings.setTimeForGame((int) localSettingsTab.getSelectedTimeLimit() * 60); } catch (Exception e) { Logging.log(e); /* * Should never happen, because user can only chose between correct * values. IGNORE Exception */ } } newGUI.newGame(); /* * Hide dialog, if everything worked as expected, leave dialog open * otherwise. */ setVisible(false); newGUI.getChessboardUI().repaint(); } catch (Exception exc) { JOptionPane.showMessageDialog(this, "Error occurred:\n" + exc.getMessage()); // $NON-NLS-1$ Logging.log(exc); } }