Class ManeuverChoiceDialog

java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
megamek.client.ui.swing.phaseDisplay.dialog.ManeuverChoiceDialog
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class ManeuverChoiceDialog extends JDialog implements ActionListener
A (somewhat primitive) dialog that asks a question and lets the player select from the available choices. The question string is tokenised on "\n".

Refactored from SingleChoiceDialog (which was based on Confirm)

See Also:
  • Constructor Details

    • ManeuverChoiceDialog

      public ManeuverChoiceDialog(JFrame parent, String title, String question)
      Create a choice dialog. The player can choose any or all of the choices. If no choices are passed in, this will be a very boring dialog, but it will not suffer an exception.
      Parameters:
      parent - - the Frame that is locked by this dialog.
      title - - the title String for this dialog.
      question - - String displayed above the choices. The question string is tokenised on "\n".
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Specified by:
      actionPerformed in interface ActionListener
    • getAnswer

      public boolean getAnswer()
      See if the player confirmed a choice.
      Returns:
      true if the player has confirmed a choice. false if the player canceled, if the player did not select a choice, or if no choices were available.
    • getChoice

      public int getChoice()
      Which choices did the player select?
      Returns:
      If no choices were available, if the player canceled, if the player did not select a choice, or if the player canceled the choice, a null value is returned, otherwise an array of the int indexes from the input array that match the selected choices is returned.
    • checkPerformability

      public void checkPerformability(int velocity, int altitude, int ceiling, boolean isVTOL, int distance, Game game, MovePath mp)