public GameOptionsDialog getGameOptionsDialog() { if (gameOptionsDialog == null) { gameOptionsDialog = new GameOptionsDialog(this); } return gameOptionsDialog; }
public void update(GameOptions options) { this.options = options; refreshOptions(); }
@Override public void windowClosing(WindowEvent e) { setVisible(false); } });
public void refreshOptions() { panOptions.removeAll(); optionComps = new HashMap<>(); for (Enumeration<IOptionGroup> i = options.getGroups(); i.hasMoreElements();) { IOptionGroup group = i.nextElement(); JPanel groupPanel = addGroup(group); for (Enumeration<IOption> j = group.getOptions(); j.hasMoreElements();) { IOption option = j.nextElement(); addOption(groupPanel, option); } } addSearchPanel(); // Make the width accomadate the longest game option label // without needing to scroll horizontally. setSize(Math.max(getSize().width, maxOptionWidth + 30), Math.max(getSize().height, 400)); validate(); }
private void menuOptionsMMActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_menuOptionsActionPerformed GameOptionsDialog god = new GameOptionsDialog(getFrame(), getCampaign().getGameOptions(), false); god.refreshOptions(); god.setEditable(true); god.setVisible(true); if (!god.wasCancelled()) { getCampaign().setGameOptions(god.getOptions()); setCampaignOptionsFromGameOptions(); refreshCalendar(); } }// GEN-LAST:event_menuOptionsActionPerformed
cancelled = false; if (client != null) { send(); doSave(); resetToDefaults(); return; } else if (e.getSource().equals(butSave)) { File gameOptsFile = selectGameOptionsFile(true); if (gameOptsFile != null) { GameOptions.saveOptions(getOptions(), gameOptsFile.getAbsolutePath()); File gameOptsFile = selectGameOptionsFile(false); if (gameOptsFile != null) { options.loadOptions(gameOptsFile, false); refreshOptions(); cancelled = true; setVisible(false);
this.options = options; setupButtons(); setupPassword(); JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.add(panButtons, GBC.eol().anchor(GridBagConstraints.CENTER)); getContentPane().add(mainPanel); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { pack(); GUIPreferences guip = GUIPreferences.getInstance(); int width = guip.getGameOptionsSizeWidth(); int height = guip.getGameOptionsSizeHeight(); setSize(width, height); setResizable(true); setLocationRelativeTo(frame); Dimension size = new Dimension((getSize().width * 40) / 100, (getSize().height * 59) / 100); panOptions.setPreferredSize(size); panOptions.setMinimumSize(size);
GameOptionsDialog god = new GameOptionsDialog(frame, g.getOptions(), false); god.update(g.getOptions()); god.setEditable(true); god.setVisible(true); for (IBasicOption opt : god.getOptions()) { IOption orig = g.getOptions().getOption(opt.getName()); orig.setValue(opt.getValue());
} else if (ev.getSource().equals(butOptions)) { if (!clientgui.getGameOptionsDialog().isEditable()) { clientgui.getGameOptionsDialog().setEditable(true); clientgui.getGameOptionsDialog().update(clientgui.getClient().getGame().getOptions()); clientgui.getGameOptionsDialog().setVisible(true); } else if (ev.getSource().equals(butCompact)) { if (butCompact.isSelected()) {
/** * Display the game options dialog. */ void showGameOptions() { GameOptions options = new GameOptions(); options.initialize(); options.loadOptions(); if (optdlg == null) { optdlg = new GameOptionsDialog(frame, options, true); } optdlg.update(options); optdlg.setVisible(true); }
/** * Called when the user selects the "View->Game Options" menu item. */ private void showOptions() { if (client.getGame().getPhase() == IGame.Phase.PHASE_LOUNGE) { getGameOptionsDialog().setEditable(true); } else { getGameOptionsDialog().setEditable(false); } // Display the game options dialog. getGameOptionsDialog().update(client.getGame().getOptions()); getGameOptionsDialog().setVisible(true); }
private void doSave() { GameOptions.saveOptions(getOptions()); }