Three matches 100, four matches 10,000, five matches 50,000, six matches 1,000,000, and zero, one, or two matches 0.
I have searched online and found nothing that was useful or made sense. My code is below, but my question is how do I limit the selection to 6 check boxes and then how would I display the results?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class JLottery extends JFrame{
FlowLayout flow = new FlowLayout();
JCheckBox[] boxes = new JCheckBox [30];
int i;
int num1 = (int)(Math.random()*30+1);
int num2 = (int)(Math.random()*30+1);
int num3 = (int)(Math.random()*30+1);
int num4 = (int)(Math.random()*30+1);
int num5 = (int)(Math.random()*30+1);
int num6 = (int)(Math.random()*30+1);
public JLottery()
{
super ("Lottery");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout (new FlowLayout());
for ( i=0 ; i < 30; i++)
{
boxes[i] = new JCheckBox ();
add(boxes[i]);
}
}
public static void main(String[] args)
{
JLottery myFrame = new JLottery();
myFrame.setSize(750,750);
myFrame.setVisible(true);
}
}

New Topic/Question
Reply



MultiQuote







|