Taking Turns on a Swing Component(Event Handling)Example
public class ClickEvent extends JFrame implements ActionListener {
private JButton click = new JButton("Click Me");
private JTextField welcomeText = new JTextField();
private JPanel thePanel = new JPanel();
thePanel.setLayout(new GridLayout(2,1));
//this.getContentPane().add(click,BorderLayout.NORTH);
thePanel.add(welcomeText);
this.getContentPane().add(thePanel,BorderLayout.CENTER);
click.addActionListener(this);