Yurttas/PL/OOL/Java/F/05/01/01/00/BLJButtons00.java

Revision as of 14:22, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="java" line start="1" enclose="div">/** * Copyright(C) 2000 * All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. * * P...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
 1/**
 2 *  Copyright(C) 2000
 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, 2000.
11 *  @author : Salih Yurttas.
12 */
13
14
15import javax.swing.*;
16
17import java.awt.*;
18
19public class BLJButtons00 extends JFrame {
20
21  public static void main(String[] args) {
22    JFrame jF = new BLJButtons00();
23
24    jF.setSize(400,320);
25    jF.setVisible(true);
26  }
27
28  private String[] bLabels = {"One",
29                              "Two",
30                              "Three"};
31  private int n = bLabels.length;
32
33  private String[] lLabels = {"North",
34                              "Center",
35                              "South"};
36
37  private JButton[] jB;
38
39  public BLJButtons00() {
40    setTitle("BLJButtons00");
41
42    BorderLayout bL = new BorderLayout();
43    this.getContentPane().setLayout(bL);
44
45    jB = new JButton[n];
46
47    for(int i=0; i<n; ++i) {
48      jB[i] = new JButton(bLabels[i]);
49      this.getContentPane().add(lLabels[i],jB[i]);
50    }
51  }
52
53}