Class ModalWidget

java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.ModalWidget

public class ModalWidget extends Widget
The ModalWidget class represents a modal window widget that can display a content panel in the center of the screen.
  • Constructor Details

    • ModalWidget

      public ModalWidget(int contentWidth, int contentHeight, Widget contentPanel)
      Constructs a new ModalWidget with the specified content width, height, and content panel.
      Parameters:
      contentWidth - the width of the content panel
      contentHeight - the height of the content panel
      contentPanel - the content panel to be displayed inside the modal
    • ModalWidget

      public ModalWidget(int contentWidth, int contentHeight)
      Constructs a new ModalWidget with the specified content width and height. A default ScrollPanelWidget is created as the content panel.
      Parameters:
      contentWidth - the width of the content panel
      contentHeight - the height of the content panel
  • Method Details

    • getBackgroundColor

      public NanoColor getBackgroundColor()
      Gets the background color of the modal widget.
      Returns:
      the background color
    • setBackgroundColor

      public void setBackgroundColor(NanoColor backgroundColor)
      Sets the background color of the modal widget.
      Parameters:
      backgroundColor - the new background color
    • getContentPanel

      public Widget getContentPanel()
      Gets the content panel of the modal widget.
      Returns:
      the content panel
    • setContentPanel

      public void setContentPanel(Widget contentPanel)
      Sets a new content panel for the modal widget. The previous content panel is removed and replaced with the new one.
      Parameters:
      contentPanel - the new content panel
    • show

      public void show()
      Open current modal window
    • close

      public void close()
      Closes the current modal window
    • update

      public void update()
      Updates the Widget
      Overrides:
      update in class Widget
    • render

      public void render()
      Renders the Widget
      Specified by:
      render in class Widget