RE:necesito un juego en java
package memorama_version_2;
import java.awt.Frame;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
public class Main extends Frame implements ActionListener
{
Button tarjeta1,tarjeta2,tarjeta3,tarjeta4,sali…
tarjeta5,tarjeta6,tarjeta7,tarjeta8,tarj…
public Main ()
{
super ("MEMORAMA");
}
public void paint (Graphics g)
{
g.drawString("PULSE SOBRE LAS CARTAS y " +
"SI FALLA DAR CLICK EN EL BOTON NUEVO",10,50);
}
public void setup ()
{
setSize(600,350);
setLayout(null);
setBackground(Color.gray);
tarjeta1=new Button("20 elevado al cubo");
tarjeta1.addActionListener(this);
tarjeta1.setSize(50, 20);
tarjeta1.setLocation(30, 30);
tarjeta1.setForeground(Color.GRAY);
add(tarjeta1);
tarjeta2=new Button("RAIZ CUADRADA DE 3");
tarjeta2.addActionListener(this);
tarjeta2.setSize(50, 20);
tarjeta2.setLocation(100, 30);
tarjeta2.setForeground(Color.GRAY);
add(tarjeta2);
tarjeta3=new Button("TEOREMA DE PITAGORAS");
tarjeta3.addActionListener(this);
tarjeta3.setSize(50, 20);
tarjeta3.setLocation(170, 30);
tarjeta3.setForeground(Color.GRAY);
add(tarjeta3);
tarjeta4=new Button("CONJUGADO DE 12+5i");
tarjeta4.addActionListener(this);
tarjeta4.setSize(50, 20);
tarjeta4.setLocation(240, 30);
tarjeta4.setForeground(Color.GRAY);
add(tarjeta4);
tarjeta5=new Button("10099+1");
tarjeta5.addActionListener(this);
tarjeta5.setSize(50, 20);
tarjeta5.setLocation(310, 30);
tarjeta5.setForeground(Color.GRAY);
add(tarjeta5);
tarjeta6=new Button("10100");
tarjeta6.addActionListener(this);
tarjeta6.setSize(50, 20);
tarjeta6.setLocation(30, 50);
tarjeta6.setForeground(Color.GRAY);
add(tarjeta6);
tarjeta7=new Button("aprox 1.73");
tarjeta7.addActionListener(this);
tarjeta7.setSize(50, 20);
tarjeta7.setLocation(100, 50);
tarjeta7.setForeground(Color.GRAY);
add(tarjeta7);
tarjeta8=new Button("el cuadrado de la hipotenusa es igual " +
"a la suma de los cuadrados de los dos catetos");
tarjeta8.addActionListener(this);
tarjeta8.setSize(50, 20);
tarjeta8.setLocation(170, 50);
tarjeta8.setForeground(Color.GRAY);
add(tarjeta8);
tarjeta9=new Button("12-5i");
tarjeta9.addActionListener(this);
tarjeta9.setSize(50, 20);
tarjeta9.setLocation(240, 50);
tarjeta9.setForeground(Color.GRAY);
add(tarjeta9);
tarjeta10=new Button("8000");
tarjeta10.addActionListener(this);
tarjeta10.setSize(50, 20);
tarjeta10.setLocation(310, 50);
tarjeta10.setForeground(Color.GRAY);
add(tarjeta10);
nuevo=new Button("LIMPIAR");
nuevo.addActionListener(this);
nuevo.setSize(80, 50);
nuevo.setLocation(70, 30);
add(nuevo);
salir=new Button("SALIR");
salir.addActionListener(this);
salir.setSize(80, 50);
salir.setLocation(130, 30);
add(salir);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}); }
public void actionPerformed (ActionEvent e)
{
if (e.getSource()==tarjeta1 && e.getSource()==tarjeta10)
{
tarjeta1.setForeground(Color.WHITE);
tarjeta10.setForeground(Color.WHITE);
}
else
{
tarjeta1.setForeground(Color.WHITE);
tarjeta10.setForeground(Color.WHITE);
if (e.getSource()==nuevo)
{
tarjeta1.setForeground(Color.GRAY);
tarjeta10.setForeground(Color.GRAY);
}
}
if (e.getSource()==tarjeta2 && e.getSource()==tarjeta7)
{
tarjeta2.setForeground(Color.WHITE);
tarjeta7.setForeground(Color.WHITE);
}
else
{
tarjeta2.setForeground(Color.WHITE);
tarjeta7.setForeground(Color.WHITE);
if (e.getSource()==nuevo)
{
tarjeta2.setForeground(Color.GRAY);
tarjeta7.setForeground(Color.GRAY);
}
}
if (e.getSource()==tarjeta3 && e.getSource()==tarjeta8)
{
tarjeta3.setForeground(Color.WHITE);
tarjeta8.setForeground(Color.WHITE);
}
else
{
tarjeta3.setForeground(Color.WHITE);