Select « JTextField « Java Swing Q&A





1. How do i select a character in a textfield?    stackoverflow.com

is it possible to select a certain character from a textfield ? Is it possible to switch their position as well? e.g. Hello is it possible to switch the position of the "H" ...

2. How can I select text over two different JTextField's?    stackoverflow.com

Lets say I have this code:

  public static void main(final String [] args)
  {
    final JFrame frame = new JFrame("Display Keyword Panel");
    final ...

3. Checking if a JTextfield is selected or not    stackoverflow.com

Is it possible to check if a jtextfield has been selected / de-selected (ie the text field has been clicked and the cursor is now inside the field)? //EDIT thanks to the help ...

6. Issue with selection of text when textfield component gains focus.    coderanch.com

Hi All, I need your suggestion on how to go ahead with the following thing. I have a JTextField and I have created a separate class WTextfield which extends the JTextField so that i can set the properties of all the textfields of my project at a single place. I have implemented Focus listener in the WTextfield so that when ever ...

7. Maintaining selection on JTextField    forums.oracle.com

get/setCaretPosition() returns the "dot" (the position where position text is or would be inserted). You need to set both ends of the selection: ie the dot and the "mark". Call setCaretPosition() as you are doing now - this will set both the dot and the mark. Then call moveCaretPosition() - this will move the dot but leave the mark, thereby creating ...