>>484の求めているのと全く同じ挙動かどうかは分からないけど,こんな感じでやってみるのはどうよ?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class KeyTest extends JFrame implements ActionListener, MouseListener, KeyListener
{
Container cp;
JTextField mainField, stateField;
JButton writeButton, clearButton;
boolean mouseIn;
public KeyTest()
{
mouseIn = false;
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(10,10,400,100);
cp = getContentPane();
cp.setLayout(new FlowLayout());
mainField = new JTextField("",10);
mainField.addKeyListener(this);
mainField.addMouseListener(this);
stateField = new JTextField("Out",10);
writeButton = new JButton("書く");
clearButton = new JButton("消す");
writeButton.addActionListener(this);
clearButton.addActionListener(this);
cp.add(mainField);
cp.add(stateField);
cp.add(writeButton);
cp.add(clearButton);
this.setVisible(true);
}