Thanks for the response.
Sorry, I did not do a very good job of giving a detailed description
of the
issue. First, you are correct, and I am not trying to code
specifically to
Ctrl-C, I am letting the platform take care of that work for me.
Secondly,
I was considering an approach similar to the one you suggest. I was
thinking
about putting a right-click popup-menu on my 'extension' of
JTextFields with a
copy choice. The button that you mention is not very feasible in my
case,
since it involves hundreds of different screens, several which are
already
'tight' on space, but it's along the same line.
Let me try and give a better description of the problem.
The Textfield may or may not be disabled based on other fields on the
screen.
So, if Field A is X, then Field B should be non-editable, and not in
the tab
order, but I still may want to be able to 'copy' the data in Field
B.
If Field A is Y, then Field B should be editable, and should be in the
tab
order.
So, the problem is making a field non-traversable with tabbing, but
still
selectable with the mouse.
If a textfield is disabled, you cannot select the text.
If it is enabled but not editable, you can select the text, but it
also is
included in the tab order.
I am having trouble finding a combination of editable, enabled,
focusTraversabl e, ... that gives me the functionality I am looking
for.
Brad BARCLAY <bb******@jsync manager.org> wrote in message news:<iH******* ***********@twi ster01.bloor.is .net.cable.roge rs.com>...
JMBollard wrote: I am working on a Swing application (Java 1.4 ) and I am having
trouble implementing the following functionality:
A JTextField that should not be part of focus traversal (should
not be tabbed to), but the text can be selected and copied (Ctrl-C).
Okay -- first off, Ctrl-C isn't Copy on every platform. Many use
Shift-Insert instead. So if you're coding a platform-neutral
application, don't hard-code Ctrl-C -- let the OS take care of it.
As to your specific issue, if you don't want to simply remove the
JTextField from the tab order, why not just disable it (as I'm assuming
you want to do) and then put a "Copy" button beside it that will take
its output and send it to the clipboard through the proper Transferrable
object? Seems to be the easiest way to me.
Brad BARCLAY