Creating P42 Preference Pane

You can find the preferences of Peeranha42 and the supplied Plugins as one tab of the GUI. As you can see here, the preference tab is organized by a JTree. Besides a main preference panel for the client, Peeranha42 offers two kinds of Preference panels for each plugin. The first one is generated automatically by the client.

Every plugin (jar file) placed in the plugin directory is listed in the Preference tab. The automatically generated panel displays information about the Plugin using the info class. Furthermore you can start and stop the plugin from this panel or mark it for auto load on start-up. If you as a developer want to use the preference tab to configure custom settings for your plugin, then you can supply these settings to the GUI by using the addPrefPanels(PluginID pid,JPanel p_panels[]) method in the main GUI class: P42_gui_default. Your panels are inserted below the branch of your plugin by order of the supplied array. Adding new branches to build up an advanced hierarchic tree (with sub branches) is not implemented yet but will be added later versions.

Adding panels:
This should happen while your plugin is starting. Call addPrefPanels(..) in your run method.

Removing the panels:
If your plugin is exiting you have to call unloadPlugin(PluginID) in your stop() method. Your panels are removed then automatically.



URL:
http://peeranha42.informatik.uni-bremen.de/pophp/index.php?section=tutorial_usingpreference.html

Date of visit:
Tue 18th Mar 2025 16:46:55