Re: Using Copy (Ctrl-C) functionality with disabled JTextFields

From: Raymond DeCampo (rdecampo_at_hold-the-spam.twcny.rr.com)
Date: 11/25/03


Date: Tue, 25 Nov 2003 01:29:17 GMT

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).
>
> This is a requirement across the whole application, which is
> hundreds of panels, so 'hard-coding' the tab order is not an option.
>
I believe the best way to accomplish this is with the
Component.setFocusTraversalPolicy() method. You could pass it a
subclass of ContainerOrderFocusTraversalPolicy with an accept() method
that rejects all JTextFields.

HTH,
Ray



Relevant Pages

  • Using Copy (Ctrl-C) functionality with disabled JTextFields
    ... 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 ...
    (comp.lang.java)
  • Re: simple input box ok button?
    ... > Im trying to do something simple, but for some reason Im having trouble ... > with this Java concept.. ... > screen AND return the text in JTextField. ... You have code that actually makes the pop-up show up right? ...
    (comp.lang.java.programmer)
  • Simple Java user interface questions.
    ... - Is there a way to control the case of text typed into a JTextField ... and JComboBox components? ... want the user to only see uppercase. ... the JFrame.EXIT_ON_CLOSE functionality? ...
    (comp.lang.java.programmer)
  • Re: Using Copy (Ctrl-C) functionality with disabled JTextFields
    ... > trouble implementing the following functionality: ... don't hard-code Ctrl-C -- let the OS take care of it. ... JTextField from the tab order, why not just disable it (as I'm assuming ... From the OS/2 WARP v4.5 Desktop of Brad BARCLAY. ...
    (comp.lang.java)