This is very short what you can do:
public class ButtonFrame extends JFrame implements ActionListener
{
private TextFieldFrame frame;
public ButtonFrame(TextFieldFrame frame)
{
this.frame = frame;
// init your components and add this as actionlistener to the button
....
}
public void actionPerformed(ActionEvent evt)
{
frame.notifyButtonPressed();
}
}
The other class:
public class TextFieldFrame extends JFrame
{
private JTextField field = ...; // init in your constructor
public void notifyButtonPressed()
{
field.setText("Yes man!! The button is pressed by the user!");
}
}
Again, this is very short what you have to do.
You can also work with a Singleton
pattern, but this is a better way.