package examples; import ise.java.awt.*; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class KappaLayoutTest { public KappaLayoutTest() { // set up a Frame Frame f = new Frame("KappaLayout Test"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } }); f.setLayout(new KappaLayout()); // standard use of KappaLayout Panel p1 = new Panel(new KappaLayout()); p1.add("0,0,1,1,7,,3", new Label("Enter name of file to copy:")); p1.add("0,1,1,1,,,3", new TextField(50)); p1.add("1,1,1,1,,hw,3", new Button("Browse...")); // use KappaLayout.Constraints, this makes a panel identical to panel p1 Panel p2 = new Panel(new KappaLayout()); KappaLayout.Constraints con = KappaLayout.createConstraint(); con.x = 0; con.y = 0; con.w = 1; con.h = 1; con.a = 7; con.p = 3; p2.add(new Label("Enter name for copy of file:"), con); con.y += 1; con.a = 0; p2.add(new TextField(50), con); con.x += 1; con.s = "wh"; p2.add(new Button("Browse..."), con); // make a button panel -- make the buttons the same width by // stretching to fill cells horizontally and setting the columns to the // same width KappaLayout kl3 = new KappaLayout(); Panel p3 = new Panel(kl3); p3.add("0,1,1,1,,w", new Button("Start Copy")); p3.add("1,1,1,1,,w", new Button("Cancel")); kl3.makeColumnsSameWidth(0, 1); // lay out the frame, using a couple of vertical struts to unclutter the parts f.add("0,0,1,1", p1); f.add("0,1,1,1", KappaLayout.createVerticalStrut(20)); f.add("0,2,1,1", p2); f.add("0,3,1,1", KappaLayout.createVerticalStrut(20)); f.add("0,4,1,1", p3); f.pack(); f.show(); } public static void main(String[] args) { KappaLayoutTest tlt = new KappaLayoutTest(); } }