PathEditor component for editing CLASSPATH or PATH
By sandipchitale on Oct 16, 2006
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.
- 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
Simply download the PathEditor.jar and execute:
> java -jar PathEditor.jar
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();
- Drag and Drop editing
- Publish JavaDoc
- java.net project
DISCLAIMER: This code is experimental. So no guarantees. Use the code at your own risk.