PathEditor component for editing CLASSPATH or PATH
Here is a simple PathEditor component that can be used to edit classpath-like structures i.e. Java CLASSPATH or PATH environment variable.
The label shows the name of the path being edited. The list shows the entries - one entry per row.

Usage
Actions:
- Delete - delete the selected entries
- Clear - delete all entries
- Move up - move slected entry up
- Move down - move selected entry down
- Copy - copy the current path to system clipboard
- View - view the current path (allows copying). The path is shown in a textarea in a dialog. The text is preselected text for easy copying.
- Edit - copy the selected entries from the list to the textfield for editing. Replace action can be used to replace the edited entries.
- Double clicking on the list copies the selected entry to the textfield
- Replace - Replace selected entries with entries in the text field.
- Add - add new entries to the end of the list or after the last selected entry (if any)
- Typing ENTER in the textfield adds the entries in the text field
- Select - browse and select entries using file chooser
Toolbar (hidden at the bottom of split pane). This is an advanced usage.
- : - use : as the path separator
- ; - use ; as the path separator
To Run
Simply download the PathEditor.jar and execute:
> java -jar PathEditor.jar
Programatic Usage
PathEditor pe = new PathEditor();
PathEditor pe = new PathEditor("CLASSPATH", "c:\lib\classes;");PathEditor pe = new PathEditor("PATH", "c:\bin;c:\usr\bin", PathEditor.PATH_TYPE.PATH);// show it in some UI
String classpath = pe.getClassPath();
To Hack
PathEditor Netbeans Project
TODO
- Drag and Drop editing
- I18N
- Publish JavaDoc
- java.net project
DISCLAIMER: This code is experimental. So no guarantees. Use the code at your own risk.
Posted by sandipchitale
( Oct 16 2006, 07:44:39 PM PDT ) Permalink
Trackback URL: http://blogs.sun.com/scblog/entry/a_patheditor_for_editing_classpath
Yes! I remembered this one. I think I will use it. Thanks.
Posted by Ramon on November 27, 2007 at 09:46 AM PST #