Tabnine Logo
GameOptionsDialog
Code IndexAdd Tabnine to your IDE (free)

How to use
GameOptionsDialog
in
megamek.client.ui.swing

Best Java code snippets using megamek.client.ui.swing.GameOptionsDialog (Showing top 12 results out of 315)

origin: MegaMek/megamek

public GameOptionsDialog getGameOptionsDialog() {
  if (gameOptionsDialog == null) {
    gameOptionsDialog = new GameOptionsDialog(this);
  }
  return gameOptionsDialog;
}
origin: MegaMek/megamek

public void update(GameOptions options) {
  this.options = options;
  refreshOptions();
}
origin: MegaMek/megamek

  @Override
  public void windowClosing(WindowEvent e) {
    setVisible(false);
  }
});
origin: MegaMek/megamek

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();
}
origin: MegaMek/mekhq

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
origin: MegaMek/megamek

  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);
origin: MegaMek/megamek

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);
origin: MegaMek/megamek

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());
origin: MegaMek/megamek

} 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()) {
origin: MegaMek/megamek

/**
 * 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);
}
origin: MegaMek/megamek

/**
 * 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);
}

origin: MegaMek/megamek

private void doSave() {
  GameOptions.saveOptions(getOptions());
}
megamek.client.ui.swingGameOptionsDialog

Javadoc

Responsible for displaying the current game options and allowing the user to change them.

Most used methods

  • <init>
    Creates new GameOptionsDialog for a Client
  • getOptions
  • refreshOptions
  • setEditable
    Update the dialog so that it is editable or view-only.
  • setVisible
  • addGroup
  • addOption
  • addSearchPanel
  • addWindowListener
  • doSave
  • getContentPane
  • getLocation
  • getContentPane,
  • getLocation,
  • getSize,
  • init,
  • isEditable,
  • isVisible,
  • pack,
  • resetToDefaults,
  • selectGameOptionsFile,
  • send

Popular in Java

  • Reactive rest calls using spring rest template
  • startActivity (Activity)
  • getSystemService (Context)
  • getExternalFilesDir (Context)
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JComboBox (javax.swing)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now