Class BasicDialog

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
ConnectionDialog, ConnectionDialogHipo

public class BasicDialog extends JDialog implements ActionListener
Author:
gavalian
See Also:
  • Field Details

    • northComponent

      protected Component northComponent
    • southComponent

      protected Component southComponent
    • eastComponent

      protected Component eastComponent
    • westComponent

      protected Component westComponent
    • centerComponent

      protected Component centerComponent
    • _closeout

      protected String[] _closeout
    • reason

      protected String reason
    • buttonPanel

      protected JPanel buttonPanel
  • Constructor Details

    • BasicDialog

      public BasicDialog(String title, boolean modal, String... closeout)
      Create a SimpleDialog
      Parameters:
      title - the title of the dialog
      modal - if true the dialog is modal
      closeout - a set of closeout labels
  • Method Details

    • addMenus

      protected void addMenus()
      Add menus to the dialog. The default implementation does nothing.
    • checkButtons

      protected void checkButtons()
      Check the enabled state of all the buttons. Default implementation does nothing.
    • sizeDialog

      protected void sizeDialog()
      This can be overriden to provde the size of the dialog. The default implementation is to call pack.
    • createNorthComponent

      protected Component createNorthComponent()
      Override to create the component that goes in the north.
      Returns:
      the component that is placed in the north
    • createSouthComponent

      protected Component createSouthComponent()
      Override to create the component that goes in the south.
      Returns:
      the component that is placed in the south. The default implementation creates a row of closeout buttons.
    • getButton

      public AbstractButton getButton(String label)
      Get the first button on this dialog with the given label. This will search all buttons, not just the closout buttons, so it is safe only if no more than one button has the given label.
      Parameters:
      label - the label to search for.
      Returns:
      the first button among its components that has the given label, or null.
    • setButtonEnabled

      public void setButtonEnabled(String label, boolean enabled)
      Enable or disable a button with a given label. Assumes no more than one button has the given label.
      Parameters:
      label - the label to match
      enabled - the enable flag
    • prepare

      protected void prepare()
      can do preparation--for example a component might be added on "createCenterComponent" but a reference needed in "addNorthComponent"
    • createEastComponent

      protected Component createEastComponent()
      Override to create the component that goes in the east.
      Returns:
      the component that is placed in the east
    • createWestComponent

      protected Component createWestComponent()
      Override to create the component that goes in the west.
      Returns:
      the component that is placed in the west.
    • createCenterComponent

      protected Component createCenterComponent()
      Override to create the component that goes in the center. Usually this is the "main" component.
      Returns:
      the component that is placed in the center
    • actionPerformed

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

      public String getReason()
      Get the reason that the dialog was closed, which is just the label of the last button hit.
      Returns:
      the label of the last button hit.
    • handleCommand

      protected void handleCommand(String command)
      A closeout button was hit. The default behavior is to shutdown the dialog.
      Parameters:
      command - the label on the button that was hit.
    • waitCursor

      public void waitCursor()
      Set the wait cursor
    • defaultCursor

      public void defaultCursor()
      Restore the default cursor
    • main

      public static void main(String[] arg)