Hmm, how to phrase this question? In our screen, whenever you tab into a field the cursor just blinks there. It is sometimes difficult to determine where the cursor is on the screen. In most programs, the field that has focus is a different background color. We have tried selectAll(), but this only selects the text that is in the field, if there is no text it selects nothing. I have one Idea, which is to create a FocusAdaptorFactory, that will pass a FocusAdaptor for the type of JComponent that it is, that Adaptor will change the background color in the FocusGained, and back to the Original in the FocusLost. However, I think this is a lot of work for simply making the user interface readable to the user. :Confused: Thanks Mark
Yeah, that is pretty much what I expected. I used VCafe and changed the BackgroundColor, and it works. But I just find that messy, and what if you really want to use the focusGained, focusLost for other purposes for the JTextField. Like one validates a date, one makes sure the correct status is entered, etc. Becuase you used up the Focus methods you have to do more inheritence, and calling super. If it was a decorator of some sort it would be really cool. Thanks for your help Mark
This is totally off the top of my head, but what about re-throwing the event?
I'm at home now, and I can't try out this idea.
Is it possible to subclass JTextField, have it implement FocusListener, consume a focusGained/Lost event, and then have the component re-throw the event, so that classes that use this subclassed component can also 'see' the event??
So what I did to solve this was to create a FocusAdapterFactory class that would take the kind of component it is, like a JTextField, JList, and JComboBox, it would return a subclass of FocusAdapter that I made that would change the background, and in the case of the JList, change Background and SelectionForeground colors. And since I realized that there can be many Focus Listeners, that all I need to put in there was changing colors. Thanks for the help Mark