BorderLayout With Gaps & TextArea

Previous     Next     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()));

   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");