Create an InputVerifier

   class MyFieldVerifier extends InputVerifier {
      public boolean verify(JComponent c) {
         // returning prevents loss of focus
         return false;
      }
   }

and then associate it with your JTextField

   setInputVerifier(new MyFieldVerifier());


-----Original Message-----
From: Rupesh Kumar
To: [EMAIL PROTECTED]
Sent: 10/27/01 1:55 PM
Subject: how to retain focus for text field

I don't wan't one of my JTextField to lose focus on TAB press. How do I
retain the focus? I overrode isManagingFocus() and isFocusTraversable()
but of no use. 
How do I do this?
 
Thanks in Advance
Rupesh.
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to