package examples; import ise.java.awt.*; import java.awt.*; import java.applet.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; public class KappaLayoutTestSwing2 extends Applet { public void init() { // set up a Frame JFrame f = new JFrame("LambdaLayout Test with Swing"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } }); LambdaLayout kl = new LambdaLayout(); JPanel contents = new JPanel(kl); f.setContentPane(contents); // layout: // LLLLLLLL 1 label, 8 columns wide // TTTTTTTB 1 textfield, 7 columns wide, 1 button // S a strut to unclutter the parts // LLLLLLLL 1 label, 8 columns wide // TTTTTTTB 1 textfield, 7 columns wide, 1 button // S a strut to unclutter the parts // BB 2 buttons contents.setBorder(new EtchedBorder()); contents.add("", LambdaLayout.createVerticalStrut(10)); contents.add("0,1,8,1,7, ,3", new JLabel("Enter name of file to copy:")); contents.add("0,2,7,1,7,w,3", new JTextField(15)); contents.add("7,2,1,1,7,w,3", new JButton("Browse...")); contents.add("0,3,1,1", LambdaLayout.createVerticalStrut(20)); contents.add("0,4,8,1,7,,3", new JLabel("Enter name of file to copy:")); contents.add("0,5,7,1,7,w,3", new JTextField(15)); contents.add("7,5,1,1,7,w,3", new JButton("Browse...")); contents.add("0,6,1,1", LambdaLayout.createVerticalStrut(20)); contents.add("4,7,1,1,,w, 3", new JButton("Start Copy")); contents.add("5,7,1,1,,w, 3", new JButton("Cancel")); kl.makeColumnsSameWidth(4,5); f.pack(); f.show(); } }