Game - import java.awt.*; import javax.swing.*; i import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.*; import javax.swing.*; import java.awt.event.*; i public class Game extends JFrame implements ActionListener { JPanel buttonPanel = new JPanel(new GridLayout(4,5)); JButton[] buttons = new JButton[20]; String names[] = {"apu", "bart", "burns", "homer", "krusty", "lisa", "maggie", "marge", "moe", "ned", "apu", "bart", "burns", "homer", "krusty", "lisa", "maggie", "marge", "moe", "ned" }; Container contentPane = getContentPane(); static int ONE = 1; static int TWO = 2; int state; int pairLeft = 10; int openCard = 0; JButton openButton1; JButton openButton2; int attempts = 0; JLabel label = new JLabel("Number of attempts: 0"); public Game() { super("Simpsons Game"); random(names); System.out.println(); for(int j=0; j < names.length; j++) { if(j%5 == 0) { System.out.println(); } System.out.print(names[j] + " "); } for(int i = 0; i < 20; i++) { buttons[i] = new JButton(); buttons[i].setActionCommand(names[i]); buttons[i].setBackground(Color.green); buttons[i].addActionListener(this);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/17/2010 for the course JAVA 021210 taught by Professor Michael during the Spring '10 term at NYU.

Page1 / 3

Game - import java.awt.*; import javax.swing.*; i import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online