Class OptionPanel

All Implemented Interfaces:
HasLocalTransform, CloneableSmartAsset, Collidable, Savable, JmeCloneable, Cloneable

public class OptionPanel extends Panel
Presents an option title, a message, and a set of option actions to the user. The message portion of the panel can be augmented with additional components as needed. This is similar to Swing's JOptionPane in functionality.
  • Field Details

  • Constructor Details

    • OptionPanel

      public OptionPanel(String message, Action... options)
      Creates a new OptionPanel without a title but with the specified message and actions.
    • OptionPanel

      public OptionPanel(String title, String message, String style, Action... options)
      Creates a new OptionPanel with the specified title, message, style, and actions.
    • OptionPanel

      public OptionPanel(String title, String message, ElementId elementId, String style, Action... options)
      Creates a new OptionPanel with the specified title, message, style, and actions.
    • OptionPanel

      protected OptionPanel(boolean applyStyles, String title, String message, Action[] options, ElementId elementId, String style)
  • Method Details

    • setTitle

      public void setTitle(String title)
      Sets the title of this option panel.
    • getTitle

      public String getTitle()
    • setMessage

      public void setMessage(String message)
      Sets the message text of this option panel that will appear on the option panel's container.
    • getMessage

      public String getMessage()
    • setOptions

      public void setOptions(Action... options)
      Sets the actions that will be turned into ActionButtons at the bottom of the panel. Any action that is clicked will also call the OptionPanel.close() method which by default removes the panel from its parent node.
    • getOptions

      public Action[] getOptions()
    • getContainer

      public Container getContainer()
      Returns the central container to which the message label was added. Callers can use this to include additional components if needed. The container by default has the SpringGridLayout in row/column setup.
    • getTitleLabel

      public Label getTitleLabel()
      Returns the label element that holds the title text.
    • getMessageLabel

      public Label getMessageLabel()
      Returns the label element that holds the message text.
    • getButtons

      public Container getButtons()
      Returns the container that holds the action buttons.
    • isVisible

      public boolean isVisible()
      Returns true if this panel is still attached to a parent and not CullHint.Always.
    • close

      public void close()
      Removes this panel from its parent. Can be overridden by subclasses to provide different close behavior.