Re: TextListener Event



It looks like your still looking for a little help, so I'll chime in.
I would add a focus listener to your JTextField.

This is fairly straight forward.
First you need to import the Listener and the Event that is associated
with it...

import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;

The FocusListener is an interface, so you must implement all of its
methods, even if you arent going to use them for anything.

There are quite a few different strategies for doing the Listeners.
For something like this, I would make it an inner class. Something
like:

class FocusHandler implements FocusListener
{
public void focusGained(FocusEvent fe)
{
}
public void focusLost(FocusEvent fe)
{
}
}
In the constructor of your GUI class, create an instance of your
FocusHandler:
FocusHandler myFocusHandler = new FocusHandler();
then add it to your components...
yourComponent.addFocusListener(myFocusHandler);

The last thing you will need to do is add the logic to the methods of
the FocusHandler class. You can find out what component has the Focus
using fe.getSource();
So you would do something like
if(fe.getSource() == myTextField)
{ //disable/enable stuffs}
else if(fe.getSource() == myComboThingy)
{ //disable/enable other stuffs}

Hope that helps.

.