lasjdljs
[rmh3093.git] / lab8 / RCS / LottoGUI.java,v
blob660e7d118627c1d6b1de02c60a6a52f5fc0c4fee
1 head    1.1;
2 access;
3 symbols;
4 locks
5         rmh3093:1.1; strict;
6 comment @# @;
9 1.1
10 date    2008.04.30.14.29.15;    author rmh3093; state Exp;
11 branches;
12 next    ;
15 desc
16 @initial commit
20 1.1
21 log
22 @Initial revision
24 text
25 @/*
26  * LottoGUI.java
27  *
28  * Version:
29  *     $Id$
30  *
31  * Revisions:
32  *     $Log$
33  */
35 import java.awt.*;
36 import javax.swing.*;
38 public class LottoGUI {
40         public LottoGUI() {
41                 JFrame mainFrame = new JFrame("CompSci Lotto");
42                 Container mainPane = mainFrame.getContentPane();
43                 mainPane.setLayout(new BorderLayout());
44                 mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
45                 mainFrame.setVisible(true);
46                 Container left = new Container();
47                 left.setLayout(new GridLayout(3,1));
48                 
49                 String [] buttonText = {"Draw","Reset","Quit"};
50                 JButton[] buttons = new JButton[3];
51                 for (int i=0; i<3; i++) {
52                         buttons[i] = new JButton();
53                         buttons[i].setText(buttonText[i]);
54                         buttons[i].setBackground(new Color(0,0,0));
55                 }
56                 buttons[0].setForeground(new Color (0,255,0));
57                 buttons[1].setForeground(new Color (255,0,0));
58                 buttons[2].setForeground(new Color (255,255,255));
59                 for (JButton b : buttons) left.add(b);
60                 
61                 mainPane.add(left, BorderLayout.WEST);
62                 
63                 Container center = new Container();
64                 center.setLayout(new GridLayout(7,7));
65                 for (int i=0; i<49; i++) {
66                         center.add(new JButton(String.valueOf(i)));
67                 }
68                 mainPane.add(center, BorderLayout.CENTER);
69                 
70                 Container bottom = new Container();
71                 bottom.setLayout(new GridLayout(1,2));
72                 bottom.add(new JLabel("Picking Numbers..."));
73                 bottom.add(new JLabel("$10",SwingConstants.RIGHT));
74                 mainPane.add(bottom, BorderLayout.SOUTH);
75                 
76                 mainFrame.pack();
77         }
79         /**
80          * Main loop
81          */
82         public static void main(String args[]) {
83                 new LottoGUI();
84         }