Class DialogBase

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public abstract class DialogBase extends JDialog
Base class for emuStudio dialogs.

Subclasses implement initializeComponents() and call buildContent() as the last statement of their constructor. The dialog is packed, centered on its parent, disposed on close, and closed by ESC (unless shouldCloseOnEscape() returns false). A disposed dialog can be shown again.

See Also:
  • Constructor Details

    • DialogBase

      protected DialogBase(Window parent, String title, boolean modal)
      Parameters:
      parent - parent window; null uses the shared Swing owner frame
      title - dialog title
      modal - whether the dialog is application-modal
  • Method Details

    • dispose

      public void dispose()
      Disposes the dialog and removes the ESC key listeners.
      Overrides:
      dispose in class Window
    • setVisible

      public void setVisible(boolean visible)
      Shows or hides the dialog; showing re-registers ESC key listeners removed by dispose().
      Overrides:
      setVisible in class Dialog
      Parameters:
      visible - whether to show the dialog
    • shouldCloseOnEscape

      protected boolean shouldCloseOnEscape()
      Checked on every ESC press; return false to let ESC propagate (e.g. to an emulated keyboard).
      Returns:
      whether ESC closes the dialog (default true)
    • buildContent

      protected void buildContent()
      Adds content from initializeComponents(), packs and centers the dialog, and installs ESC handling. Must be the last statement of the subclass constructor.
    • initializeComponents

      protected abstract JComponent initializeComponents()
      Returns:
      main content component, or null for an empty dialog