posted 16 years ago
Hi,
I have a JTree which displays the names of natural languages (dutch, english, french) grouped by their families (romanic, germanic). When a language is selected, a page with info on it is opened in another pane, which, among other things, allows the user to alter its name. The families have no such page, so I need their nodes to be editable. I use one type of node, LanguageTreeNode. It can display both types:
In the panel where I show the JTree, I call it languagesTree, and I make it editable by doing:
FamilyTreeCellEditor is implemented as follows:
To store the new value, I have this method in my model:
Where FamilyHelper.update() is a static function that updates the record in the database and config.getCon() returns connection parameters for the database, which FamilyHelper.update() needs.
I have a few questions. First of all, how can I set the Language nodes as non-editable? I have searched for a setIsEditable() or setEditable() method but can't find any.
Secondly, the editor is always invoked on single-click, which is annoying, because I want a single click to only select the node. Where can I specify that only a double click (or whatever is the standard on the used look-and-feel/platform) should invoke the editor?
Thanks for any help.