Question - making rummy card game applet
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.util.Random;
import java.lang.*;
public class CardGame extends Applet implements ActionListener {
Button Deal;
Button NewGame;
Button PutDown;
Color bgColor;
Color rectColor;
Image deck;
MediaTracker mt;
CheckboxGroup radioGroup;
Checkbox radio1;
Checkbox radio2;
Checkbox radio3;
Checkbox radio4;
Checkbox radio5;
Checkbox radio6;
Checkbox radio7;
**Its hard to tell but the arrays are commented out for now.
//String[] faceValue = {"ACE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING"};
// String[] suitValue = {"CLUBS", "HEARTS", "SPADES", "DIAMONDS"};
public void init()
{
setLayout(null);
mt = new MediaTracker(this);
Deal = new Button("Deal");
NewGame = new Button("New Game");
PutDown = new Button("Put Down");
Deal.setBounds(750, 450, 75, 25);
NewGame.setBounds(750, 475, 75, 25);
PutDown.setBounds(750, 425, 75, 25);
add(Deal);
add(NewGame);
add(PutDown);
Deal.addActionListener(this);
NewGame.addActionListener(this);
PutDown.addActionListener(this);
radioGroup = new CheckboxGroup();
radio1 = new Checkbox(" ", radioGroup, false);
radio2 = new Checkbox(" ", radioGroup, false);
radio3 = new Checkbox(" ", radioGroup, false);
radio4 = new Checkbox(" ", radioGroup, false);
radio5 = new Checkbox(" ", radioGroup, false);
radio6 = new Checkbox(" ", radioGroup, false);
radio7 = new Checkbox(" ", radioGroup, false);
add(radio1);
add(radio2);
add(radio3);
add(radio4);
add(radio5);
add(radio6);
add(radio7);
radio1.setBounds(143, 525, 10, 10);
radio2.setBounds(222, 525, 10, 10);
radio3.setBounds(301, 525, 10, 10);
radio4.setBounds(380, 525, 10, 10);
radio5.setBounds(459, 525, 10, 10);
radio6.setBounds(538, 525, 10, 10);
radio7.setBounds(617, 525, 10, 10);
}
public void Randomize()
{
//this is where I need the help mostly.
}
public void Stop()
{
}
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource()== Deal)
{
setBackground(Color.green); //test
}
else
{
Deal.setLabel("Not there, here!"); //another test
}
if(radio1.getState())
{
setBackground(Color.blue); //just a test to make sure I know how to use the radio buttons
}
}
public void paint(Graphics g) {
g.drawString("Welcome to Rummy!!", 300, 50 );
g.drawRect(100, 100, 600, 440);
g.drawRect(110, 420, 75, 100);
g.drawRect(190, 420, 75, 100);
g.drawRect(270, 420, 75, 100);
g.drawRect(350, 420, 75, 100);
g.drawRect(430, 420, 75, 100);
g.drawRect(510, 420, 75, 100);
g.drawRect(590, 420, 75, 100);
g.drawRect(110, 120, 75, 100);
g.drawRect(190, 120, 75, 100);
g.drawRect(270, 120, 75, 100);
g.drawRect(350, 120, 75, 100);
g.drawRect(430, 120, 75, 100);
g.drawRect(510, 120, 75, 100);
g.drawRect(590, 120, 75, 100);
g.drawRect(300, 250, 75, 100);
g.drawRect(380, 250, 75, 100);
g.drawString("A S", 220, 445);
}
}

