Yurttas/PL/OOL/Java/F/05/01/01/02/GLJ01.java

From ZCubes Wiki
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 2002
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : January 1, 2002.
11 *  @author : Salih Yurttas.
12 */
13
14
15import javax.swing.*;
16
17import java.awt.*;
18
19public class GLJ01 extends JFrame {
20
21  public static void main(String[] args) {
22    JFrame jF = new GLJ01();
23
24    jF.setSize(400,320);
25    jF.setVisible(true);
26  }
27
28  private String[] labels = {"Name",
29			     "PhoneNumber"};
30  private int nLabels = labels.length;
31
32  public GLJ01() {
33    setTitle("GLJ01");
34
35    GridLayout gL = new GridLayout(3,1);
36    this.getContentPane().setLayout(gL);
37
38    JPanel[] jP = new JPanel[3];
39
40    for(int i=0; i<nLabels; ++i) {
41      jP[i] = new JPanel(new GridLayout(1,2));
42      jP[i].add(new JLabel(labels[i]));
43      jP[i].add(new JTextField("", 24));
44      this.getContentPane().add(jP[i]);
45    }
46
47    jP[2] = new JPanel(new FlowLayout());
48    jP[2].add(new JButton("Query"));
49    this.getContentPane().add(jP[2]);
50  }
51
52}