The Java Program: FlowLayoutDemo.java

  1 // FlowLayoutDemo.java -- Illustrate "flow" layout; adapted from Naughton
  2 
  3 /*
  4  * <applet code="FlowLayoutDemo.class" width=280 height=100></applet>
  5  */
  6 
  7 import java.applet.Applet;
  8 import java.awt.*;
  9 import java.util.*;
 10 
 11 public class FlowLayoutDemo extends Applet {
 12 
 13    public void init() {
 14       setLayout (new FlowLayout(FlowLayout.RIGHT, 10, 3));
 15 
 16       Dimension d = this.size();
 17       int width  = d.width;
 18       int height = d.height;
 19 
 20       String val = "Data is not information " +
 21                    "is not knowledge is not wisdom.";
 22       StringTokenizer st = new StringTokenizer(val);
 23       while(st.hasMoreTokens()) {
 24           add(new Button(st.nextToken()));
 25       }
 26    }
 27 }