Module jEdit

Class AbstractOptionPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, OptionPane
Direct Known Subclasses:
AbbrevsOptionPane, AbstractContextOptionPane, AppearanceOptionPane, BrowserColorsOptionPane, BrowserOptionPane, BufferOptionPane, DockingOptionPane, EditingOptionPane, EditModesPane, EncodingsOptionPane, FirewallOptionPane, GeneralOptionPane, GutterOptionPane, LargeFilesOptionPane, ModeSettingsPane, MouseOptionPane, OptionGroupPane, PluginManagerOptionPane, PluginOptionGroup.NoPluginsPane, PluginOptions.NoPluginsPane, PrintOptionPane, SaveBackupOptionPane, ShortcutsOptionPane, StatusBarOptionPane, SyntaxHiliteOptionPane, TextAreaOptionPane, ToolBarOptionPane, UndoPane, ViewOptionPane

public class AbstractOptionPane extends JPanel implements OptionPane
The default implementation of the option pane interface.

See EditPlugin for information on how jEdit obtains and constructs option pane instances.

Most option panes extend this implementation of OptionPane, instead of implementing OptionPane directly. This class provides a convenient default framework for laying out configuration options.

It is derived from Java's JPanel class and uses a GridBagLayout object for component management. Since GridBagLayout can be a bit cumbersome to use, this class contains shortcut methods to simplify layout:

Version:
$Id: AbstractOptionPane.java 24946 2019-08-23 07:46:38Z vampire0 $
Author:
Slava Pestov, John Gellene (API documentation)
See Also:
  • Field Details

    • initialized

      protected boolean initialized
      Has the option pane been initialized?
    • gridBag

      protected GridBagLayout gridBag
      The layout manager.
    • y

      protected int y
      The number of components already added to the layout manager.
  • Constructor Details

    • AbstractOptionPane

      public AbstractOptionPane(String internalName)
      Creates a new option pane.
      Parameters:
      internalName - The internal name. This should be the same name as that provided in the plugin's plugin.className.option-group or .option-pane property. The option pane's label is set to the value of the property named options.name.label.
  • Method Details

    • getName

      public String getName()
      Returns the internal name of this option pane. The option pane's label is set to the value of the property named options.name.label.
      Specified by:
      getName in interface OptionPane
      Overrides:
      getName in class Component
      Returns:
      the internal name of this option pane. The option pane's label is set to the value of the property named options.name.label.
      See Also:
    • getComponent

      public Component getComponent()
      Returns the component that should be displayed for this option pane. Because this class extends Component, it simply returns "this".
      Specified by:
      getComponent in interface OptionPane
      Returns:
      the component that should be displayed for this option pane.
    • init

      public final void init()
      Description copied from interface: OptionPane
      This method is called every time the option pane is displayed.
      Specified by:
      init in interface OptionPane
    • save

      public final void save()
      Description copied from interface: OptionPane
      Called when the options dialog's "ok" button is clicked. This should save any properties being edited in this option pane.
      Specified by:
      save in interface OptionPane
    • newLabel

      public JLabel newLabel(String label, Component comp)
      Parameters:
      label - The label to associate with comp
      comp - The component to associate the label
      Returns:
      a label which has the same tooltiptext as the Component that it is a label for. This is used to create labels from inside AbstractOptionPane.
      Since:
      jEdit 4.3pre4
    • addComponent

      public void addComponent(String label, Component comp)
      Adds a labeled component to the option pane. Components are added in a vertical fashion, one per row. The label is displayed to the left of the component.
      Parameters:
      label - The label
      comp - The component
    • addComponent

      public void addComponent(String label, Component comp, int fill)
      Adds a labeled component to the option pane. Components are added in a vertical fashion, one per row. The label is displayed to the left of the component.
      Parameters:
      label - The label
      comp - The component
      fill - Fill parameter to GridBagConstraints for the right component
    • addComponent

      public void addComponent(Component comp1, Component comp2)
      Adds a labeled component to the option pane. Components are added in a vertical fashion, one per row. The label is displayed to the left of the component.
      Parameters:
      comp1 - The label
      comp2 - The component
      Since:
      jEdit 4.1pre3
    • addComponent

      public void addComponent(Component comp1, Component comp2, int fill)
      Adds a labeled component to the option pane. Components are added in a vertical fashion, one per row. The label is displayed to the left of the component.
      Parameters:
      comp1 - The label
      comp2 - The component
      fill - Fill parameter to GridBagConstraints for the right component
      Since:
      jEdit 4.1pre3
    • addComponent

      public void addComponent(Component comp)
      Adds a component to the option pane. Components are added in a vertical fashion, one per row.
      Parameters:
      comp - The component
    • addComponent

      public void addComponent(Component comp, int fill)
      Adds a component to the option pane. Components are added in a vertical fashion, one per row.
      Parameters:
      comp - The component
      fill - Fill parameter to GridBagConstraints
      Since:
      jEdit 4.2pre2
    • addSeparator

      public void addSeparator()
      Adds a separator component.
      Since:
      jEdit 4.1pre7
    • addSeparator

      public void addSeparator(String label)
      Adds a separator component.
      Parameters:
      label - The separator label property
      Since:
      jEdit 2.6pre2
    • _init

      protected void _init()
      This method should create and arrange the components of the option pane and initialize the option data displayed to the user. This method is called when the option pane is first displayed, and is not called again for the lifetime of the object.
    • _save

      protected void _save()
      Called when the options dialog's "ok" button is clicked. This should save any properties being edited in this option pane.