sadjfda
[rmh3093.git] / lab7 / LottoGUI.java
blob556e929616e949fe5a43e2f9c2d91eeeda78bcdb
1 /*
2 * LottoGUI.java
4 * Version:
5 * $Id: LottoGUI.java,v 1.1 2008/04/30 14:29:15 rmh3093 Exp rmh3093 $
7 * Revisions:
8 * $Log: LottoGUI.java,v $
9 * Revision 1.1 2008/04/30 14:29:15 rmh3093
10 * Initial revision
14 import java.awt.*;
15 import javax.swing.*;
17 public class LottoGUI {
19 public LottoGUI() {
20 JFrame mainFrame = new JFrame("CompSci Lotto");
21 Container mainPane = mainFrame.getContentPane();
22 mainPane.setLayout(new BorderLayout());
23 mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
24 mainFrame.setVisible(true);
25 Container left = new Container();
26 left.setLayout(new GridLayout(3,1));
28 String [] buttonText = {"Draw","Reset","Quit"};
29 JButton[] buttons = new JButton[3];
30 for (int i=0; i<3; i++) {
31 buttons[i] = new JButton();
32 buttons[i].setText(buttonText[i]);
33 buttons[i].setBackground(new Color(0,0,0));
35 buttons[0].setForeground(new Color (0,255,0));
36 buttons[1].setForeground(new Color (255,0,0));
37 buttons[2].setForeground(new Color (255,255,255));
38 for (JButton b : buttons) left.add(b);
40 mainPane.add(left, BorderLayout.WEST);
42 Container center = new Container();
43 center.setLayout(new GridLayout(7,7));
44 for (int i=0; i<49; i++) {
45 center.add(new JButton(String.valueOf(i)));
47 mainPane.add(center, BorderLayout.CENTER);
49 Container bottom = new Container();
50 bottom.setLayout(new GridLayout(1,2));
51 bottom.add(new JLabel("Picking Numbers..."));
52 bottom.add(new JLabel("$10",SwingConstants.RIGHT));
53 mainPane.add(bottom, BorderLayout.SOUTH);
55 mainFrame.pack();
58 /**
59 * Main loop
61 public static void main(String args[]) {
62 new LottoGUI();