summaryrefslogtreecommitdiffstats
path: root/lib/example/MyClass.java
blob: ef47aced3cc1560337cb7f829b4a8ef18577c2b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package example;


import java.awt.Button;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import layout.TableLayout;

public class MyClass {

    public static void main(String args[]) {
        Frame frame = new Frame("MyTitle");
        frame.setBounds(100, 100, 300, 300);

        double size[][] =
            {{-2.0, 10.0, 50.0, -1.0, 10.0},  // Columns
                {-2.0, 10.0, 0.25, -1.0, 10.0}}; // Rows

        frame.setLayout(new TableLayout(size));

        Button button;
        button = new Button("3, 3, R, C");
        frame.add(button, "3, 3, R, C");
        button = new Button("3, 3, L, T");
        frame.add(button, "3, 3, L, T");
        button = new Button("2, 3, C, T");
        frame.add(button, "2, 3, C, T");
        button = new Button("3, 2, L, C");
        frame.add(button, "3, 2, L, C");
        button = new Button("2, 2, F, F");
        frame.add(button, "2, 2, F, F");
        button = new Button("3, 3, C, C");
        frame.add(button, "3, 3, C, C");

        frame.addWindowListener
            (new WindowAdapter() {
                 public void windowClosing(WindowEvent e) {
                     System.exit(0);
                 }
             }
            );

        frame.show();
    }
}