Class ButtonPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class ButtonPanel extends JPanel
See Also:
  • Field Details

  • Constructor Details

    • ButtonPanel

      public ButtonPanel(String[] labels)
      The constructor.
      Parameters:
      labels - The button labels.
    • ButtonPanel

      public ButtonPanel(String[] labels, ActionListener alist)
      The constructor.
      Parameters:
      labels - The button labels.
      alist - Optional action listener.
    • ButtonPanel

      public ButtonPanel(String[] labels, ActionListener alist, int spacing)
      The constructor.
      Parameters:
      labels - The button labels.
      alist - Optional action listener.
      spacing - The spacing between labels.
    • ButtonPanel

      public ButtonPanel(String[] labels, ActionListener alist, int spacing, int alignment)
      The constructor.
      Parameters:
      labels - the button labels.
      alist - optional action listener.
      spacing - the spacing between labels.
      alignment - the layout alignment
  • Method Details

    • userSetup

      protected void userSetup()
      Place for subclasses to add something else
    • addButtons

      protected void addButtons(ActionListener alist)
      Add the buttons to the panel.
      Parameters:
      alist - An action listener.
    • setEnabled

      public void setEnabled(int index, boolean state)
      Enable or disable a button.
      Parameters:
      index - the index of the button. If -1, applies to all.
      state - if true, enable, else disable.
    • setToolTip

      public void setToolTip(int index, String tip)
      Set tooltip
      Parameters:
      index - The index of the button.
      tip - tooltip string
    • getInsets

      public Insets getInsets()
      Overrides:
      getInsets in class JComponent
    • closeOutPanel

      public static ButtonPanel closeOutPanel(int opt, ActionListener actionListener, int spacing)
      Makes a button panel with combinations of OK, Save, Save As, Cancel, Apply, and Delete
      Parameters:
      opt - Bitwise combination of USE_OK, USE_CANCEL, USE_APPLY, USE_DELETE
      actionListener - Action listener for button clicks
      spacing - The spacing between labels.