10 date 2008.04.30.14.29.15; author rmh3093; state Exp;
38 public class 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));
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));
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);
61 mainPane.add(left, BorderLayout.WEST);
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)));
68 mainPane.add(center, BorderLayout.CENTER);
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);
82 public static void main(String args[]) {