Click to See Complete Forum and Search --> : Cut & Copy Toolbar problem


ssherlock
September 17th, 2000, 03:12 AM
We have an app with Cut, Copy & Paste buttons on a JToolbar. However, when text in textfield selected and press Copy or Cut textfield loses focus and nothing cut/copied. This works OK from the Edit menu though. How do we stop the toolbar stealing the focus/selection of the textfields ?

Phill
September 17th, 2000, 03:42 AM
Hi there
Maybe you could try the method
yourJTextfield.requestFocus();
Try to use this on the line before you
cut,copy or paste. This will be in your event capturing method.
I think you will find that the text is still
selected when the JTextfield gets the focus back.

Good luck
Phill.

manoj_bvm
March 22nd, 2002, 03:47 AM
Hi,
You have said that it is working fine from the menu. Can i have some help regarding that since i face the same problem even when i do cut/copy from Menu action.
I've also tried giving request focus to the JTextFiedl in the menu action listener for cut/copy. But still i have the problem of cut/copy.
If some text is there already the whole text is being copied or cut even if i had selected only some part of the text. Is there any solution for this.

Thanks,
Manoj.