Most plugin option panes extend this implementation of OptionPane, instead of implementing OptionPane directly. It provides a convenient default framework for laying out configuration options in a manner similar to the option panes created by jEdit itself. It is derived from Java's JPanel class and contains a GridBagLayout object for component management. It also contains shortcut methods to simplify layout.
The constructor for a class derived from AbstractOptionPane should call the parent constructor and pass the option pane's "internal name" as a parameter. The internal name is used to key a property where the option pane's label is stored; see the section called "Plugin Properties". It should also implement two methods:
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.
protected void _save(
)
;
This method should save any settings, to the jEdit properties or other data store.
AbstractOptionPane also contains three shortcut methods, typically called from _init(), for adding components to the option pane:
protected void addComponent( | String | label, |
Component | comp) ; |
protected void addComponent( | Component | comp) ; |
These shortcut methods add components to the option pane in a single vertical column, running top to bottom. The first displays the text of the label parameter to the left of the Component represented by comp.
protected void addSeparator(
String label)
;
This is another shortcut method that adds a text label between two horizontal separators to the option pane. The label parameter represents the name of a property (typically a property defined in the plugin's property file) whose value will be used as the separator text.