posted 23 years ago
You guys are getting too complicated and for no reason at all. You seem to forget that all Components dispatch events to their respective listeners using the following methods in JComponent...
processComponentEvent( ComponentEvent)
processEvent( AWTEvent)
processFocusEvent( FocuseEvent)
...and so on.
Basically, when an event is generated from a JComponent, and for arguments sake, lets say it was a FocusEvent, the processFocusEvent(FocusEvent) method will send the event to all of the components FocusListeners, if any at all. So, if you override this mthod, you control the dispatching of events from your component to the respective listeners.
You need to subclass JTextField and override the approproate processEvent() methods to solve your problem. I can tell you this, you dont need to set up listeners because you will be catching the event too late if you do. By overriding tje processEvent() methods, you control the dispatching of events and therefore should be able to control focus, validation, etc.
hope that helps you,
SAF