BorderLayout With Gaps & TextArea

Previous     Next     blgat.java     BLGAT.java     Home     Package

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class BLGAT extends JFrame implements ActionListener {
   JButton doit;
   JTextArea text;

   public BLGAT () {
      setLayout(new BorderLayout(20,20));
      add("North",new JButton("North"));
      add("South",doit = new JButton("South"));
      add("East",new JButton("East"));
      add("West",new JButton("West"));
      add("Center",new JScrollPane(text = new JTextArea()));
      doit.addActionListener(this);
   }

   public void actionPerformed (ActionEvent evt) {
      for (int i=0 ; i < 50 ; i++)
	 text.append("Now is the "+i+"th time to come to the party's aid\n");
   }
}