Using the P42 GUI
Peeranha42 offers a default GUI-Manager with the possibility to display
one or more GUI-panels in a common tabbed window or each GUIpanel in an
own frame.
Most public functions can be called with "P42_gui_default.[function()]".
Since there is no sense in instantiating more than one user interface, the public
functions (to be used by the Plugins) are static. The constructor itself is private
and invoked indirectly by a public static method which checks that there isn't
another instantiation running yet before actually invoking it.
To integrate an own GUI-panel in the common GUI, a developer just has to use a
P42_application_pane. This is an extended class from javax.swing.Jpanel and can
be either still extended or simply instantiated.
The swing components and layout inside the panel are completely up to the plugin
programmer. The panel(s) shall then be added to a dynamic list and this list added
to the GUI-manager.
After use, e.g. when the stop () method of the plugin is invoked, the panels that
aren't needed shall be removed. Bellow there is a short list of the most important
methods needed by plugin developers for using the common GUI. For more detailed
information about the respective methods, constructors or classes, please refer to
the online APIdocumentation. The constructors from the P42_application_pane:
public P42_application_pane(String title,
int state,
PluginID pid)
The public methods from the P42_application_pane:
public PluginID getPluginID()
public void setPluginID(PluginID pid)
public String getTitle()
public int getPreferredState()
public void setPreferredState(int state)
The public field constants from the P42_default_gui:
public static final int NON_DETACHEABLE
public static final int ATTACHED
public static final int DETACHED
The public methods from the P42_default_gui:
public static void startGUI()
public static void main(String args[])
//(intended to start just the GUI
for debugging purposes)
public static void addAppPanes(final Vector tempApps
public static void removeAppPanes(final Vector tempApps)
public static void removeAppPanes(final PluginID pId)
public static boolean addPrefPanels(PluginID pid,
JPanel p_panels[])
>> back
|