Search code examples
javaswinguser-interfacelistenerjtextfield

Show Event for JTextField in Java?


I'm implementing a specialized version of JTextField and want to pack it into an own bean. The bean works pretty fine so far. Here's my question:

How can I detect when the JTextField is shown? So that I can init some graphical stuff everytime the fields are shown.

The ShowComponent event does not work for me. FocusGained and FocusLost works just fine.

Hope there's somebody who knows the solution to this.


Solution

  • Can you use the isShowing() method? http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html#isShowing%28%29