Class OptionPanelState

java.lang.Object
com.jme3.app.state.BaseAppState
com.simsilica.lemur.OptionPanelState
All Implemented Interfaces:
AppState

public class OptionPanelState extends BaseAppState
Provides modal option panel support where the option panel is the only thing that can receive mouse/touch input until closed. Note: requires PopupState to have also been attached, which is done by GuiGlobals by default. This class is now just a thin wrapper around the standard PopupState.
  • Constructor Details

    • OptionPanelState

      public OptionPanelState()
    • OptionPanelState

      public OptionPanelState(String style)
    • OptionPanelState

      public OptionPanelState(ElementId defaultElementId, String style)
    • OptionPanelState

      public OptionPanelState(Node guiNode)
  • Method Details

    • show

      public void show(String title, String message, Action... options)
      Creates and displays a modal OptionPanel with the specified settings. The option panel will be visible until the user clicks a response or until close() is called.
    • show

      public void show(String title, String message, ElementId elementId, Action... options)
      Creates and displays a modal OptionPanel with the specified settings. The option panel will be visible until the user clicks a response or until close() is called.
    • getName

      protected String getName(Throwable t)
    • showError

      public void showError(String title, Throwable t)
      Creates and displays a model OptionPanel with the specified error information. An attempt is made to construct a useful message for the specified Throwable. The option panel will be visible until the user clicks a response or until close() is called.
    • showError

      public void showError(String title, Throwable t, ElementId elementId)
      Creates and displays a model OptionPanel with the specified error information. An attempt is made to construct a useful message for the specified Throwable. The option panel will be visible until the user clicks a response or until close() is called.
    • show

      public void show(OptionPanel panel)
      Modally shows the specified OptionPanel in the guiNode as defined by getGuiNode(). An invisible blocker geometry is placed behind it to catch all mouse events until the panel is closed. The option panel will be visible until the user clicks a response or until close() is called.
    • close

      public void close()
      Closes an open OptionPanel if one is currently open. Does nothing otherwise.
    • getCurrent

      public OptionPanel getCurrent()
      Returns the currently displayed OptionPanel or null if no option panel is visible.
    • setStyle

      public void setStyle(String style)
      Sets the style that will be used for created OptionPanels.
    • getStyle

      public String getStyle()
      Returns the style that will be used for created OptionPanels.
    • setGuiNode

      public void setGuiNode(Node guiNode)
      Sets the GUI node that will be used to display the option panel. By default, this is SimpleApplication.getGuiNode().
    • getGuiNode

      public Node getGuiNode()
      Returns the GUI node that will be used to display the option panel. This is now always PopupState.getGuiNode()
    • initialize

      protected void initialize(Application app)
      Description copied from class: BaseAppState
      Called during initialization once the app state is attached and before onEnable() is called.
      Specified by:
      initialize in class BaseAppState
      Parameters:
      app - the application
    • cleanup

      protected void cleanup(Application app)
      Description copied from class: BaseAppState
      Called after the app state is detached or during application shutdown if the state is still attached. onDisable() is called before this cleanup() method if the state is enabled at the time of cleanup.
      Specified by:
      cleanup in class BaseAppState
      Parameters:
      app - the application
    • onEnable

      protected void onEnable()
      Description copied from class: BaseAppState
      Called when the state is fully enabled, ie: is attached and isEnabled() is true or when the setEnabled() status changes after the state is attached.
      Specified by:
      onEnable in class BaseAppState
    • update

      public void update(float tpf)
      Description copied from interface: AppState
      Called to update the AppState. This method will be called every render pass if the AppState is both attached and enabled.
      Specified by:
      update in interface AppState
      Overrides:
      update in class BaseAppState
      Parameters:
      tpf - Time since the last call to update(), in seconds.
    • onDisable

      protected void onDisable()
      Description copied from class: BaseAppState
      Called when the state was previously enabled but is now disabled either because setEnabled(false) was called or the state is being cleaned up.
      Specified by:
      onDisable in class BaseAppState