valueForPathChanged

C

cool2005

I tried to rename a tree node and what is considered
"valueForPathChanged"...

After I trible clicked at the node, the JTextField appear, I can
enter/change text. But I received a "editingCanceled" event as soon as
I clicked away from the editing node. Normally, in windows, if you
rename a file/directory and click away, the change is committed.

My question is

What do I do using mouse/keyboard to have valueForPathChanged called
in my custom TreeModel class?

Any help will be really appreciated.

thanks
 
R

Roland

I tried to rename a tree node and what is considered
"valueForPathChanged"...

After I trible clicked at the node, the JTextField appear, I can
enter/change text. But I received a "editingCanceled" event as soon as
I clicked away from the editing node. Normally, in windows, if you
rename a file/directory and click away, the change is committed.

My question is

What do I do using mouse/keyboard to have valueForPathChanged called
in my custom TreeModel class?

Any help will be really appreciated.

thanks
Pressing the Enter/Return key should end the editing and accept the new
value.
Pressing Escape cancels the cell editing.
Clicking away also cancels the cell editing. However, this could be
Look&Feel dependent. If your app uses the default Swing L&F, clicking
away cancels. Maybe with Windows L&F, clicking away behaves like Windows
and accepts the value; just a case of trying it out, I guess.

The F2 key starts editing the selected tree cell (but maybe this is also
L&F dependent).

--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
R

Roland

Pressing the Enter/Return key should end the editing and accept the new
value.
Pressing Escape cancels the cell editing.
Clicking away also cancels the cell editing. However, this could be
Look&Feel dependent. If your app uses the default Swing L&F, clicking
away cancels. Maybe with Windows L&F, clicking away behaves like Windows
and accepts the value; just a case of trying it out, I guess.

The F2 key starts editing the selected tree cell (but maybe this is also
L&F dependent).
Just a small correction.

Clicking away by selecting a new tree node causes the editing to be
canceled (and the value to remain the same).

If you click away without selecting another treenode the selected cell
remains in editing mode. [All with default Swing L&F.]
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
C

Christian Kaufhold

Roland said:
Pressing the Enter/Return key should end the editing and accept the new
value.
Pressing Escape cancels the cell editing.
Clicking away also cancels the cell editing. However, this could be
Look&Feel dependent. If your app uses the default Swing L&F, clicking
away cancels. Maybe with Windows L&F, clicking away behaves like Windows
and accepts the value; just a case of trying it out, I guess.

It depends on the property "invokesStopCellEditing" whether it cancels
or commits.



Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top