Class PropertiesDialog

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

public class PropertiesDialog extends JDialog
Generated by the generateDialog() method in PropertiesManager. This dialog displays all the non-hidden properties managed by the PropertiesManager and allows user editing. If there are more than one category of properties, a tabbed pane is generated automatically. For each category, if there is more than one subcategory, header labels will be generated on the FormPanel as needed. Basically, this provides a very easy way for applications to expose their properties in a simple but extensible way.

Custom form handling - it may be the case that you need to do custom form handling (eg. field B should only be visible/enabled if field A contains a certain value). In that case, you shouldn't go through generateDialog() in PropertiesManager, but rather create the dialog yourself. This isn't as hard as it sounds... see javadocs on generateDialog() for more information.

Since:
2024-12-30
Author:
scorbo2
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • setVisible

      public void setVisible(boolean visible)
      Overridden to update our position if the owner window moves.
      Overrides:
      setVisible in class Dialog
      Parameters:
      visible - Whether to show or hide the dialog.
    • wasOkayed

      public boolean wasOkayed()
      Reports whether this dialog was closed via the OK button, meaning that the form was validated and all values are acceptable.
      Returns:
      true if the form was validated and closed via the OK button, false otherwise.
    • findFormField

      public FormField findFormField(String identifier)
      Returns the FormField with the given identifier if it exists on this dialog.
      Parameters:
      identifier - The string identifier of the field in question.
      Returns:
      A FormField instance representing that field, or null if not found.
    • buildScrollPane

      public static JScrollPane buildScrollPane(Component component)
      A static convenience method to generate a JScrollPane with more sensible default values. Seriously, why is the default behaviour to scroll 1 pixel at a time when you mouse wheel?
      Parameters:
      component - Any Component that needs scrolling.
      Returns:
      A JScrollPane that won't take a million years to scroll through.
    • buildScrollPane

      public static JScrollPane buildScrollPane(Component component, int unitIncrement)
      A static convenience method to generate a JScrollPane with more sensible default values. Seriously, why is the default behaviour to scroll 1 pixel at a time when you mouse wheel?
      Parameters:
      component - Any Component that needs scrolling.
      unitIncrement - How much to scroll by (I believe this is a pixel value).
      Returns:
      A JScrollPane that won't take a million years to scroll through.
    • getFormPanelAt

      public FormPanel getFormPanelAt(int index)
      Returns the FormPanel from the tab with the given index. If the tab is out of range, or if no FormPanel can be found on that tab for any reason, this returns null.
      Parameters:
      index - The tab index in question.
      Returns:
      A FormPanel instance, or null if not found.
    • validateFormAndClose

      protected void validateFormAndClose()
    • buildButtonPanel

      protected JPanel buildButtonPanel()