Java Gusanito Juego

Páginas: 2 (261 palabras) Publicado: 12 de julio de 2011
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;

/**
* La guerra de los gusanos.
* Ecosistema, botones y lista.
*
*/
public class WormWar extends Applet
{private static Point getScreenCenter (Dimension dim)
{
Dimension dimScreen = Toolkit.getDefaultToolkit().getScreenSize ();
return new Point ((dimScreen.width - dim.width) / 2,(dimScreen.height - dim.height) / 2);
}

public static void main (String [] args)
{
frame = new Frame ("Guerra de Gusanos");
frame.addWindowListener (new WindowAdapter() {
public void windowClosing (WindowEvent e) {
System.exit (0);
}
});
Dimension dim = new Dimension (600, 600);
frame.setSize(dim.width, dim.height);
Point center = getScreenCenter (dim);
frame.setLocation (center.x, center.y);

Applet applet = new WormWar ();
frame.add(applet);
applet.init ();
applet.start ();

frame.setVisible (true);
}

private void makeEvents ()
{
buttonNew.addActionListener (newActionListener () {
public void actionPerformed (ActionEvent e) {
wormEcosystem.init ();
wormEcosystem.requestFocus ();
}
});choiceNumPlayers.addItemListener (new ItemListener () {
public void itemStateChanged (ItemEvent e) {
wormEcosystem.setNumPlayers (1 + choiceNumPlayers.getSelectedIndex ());wormEcosystem.requestFocus ();
}
});
choiceNumWorms.addItemListener (new ItemListener () {
public void itemStateChanged (ItemEvent e) {wormEcosystem.setNumWorms (1 + choiceNumWorms.getSelectedIndex ());
wormEcosystem.requestFocus ();
}
});

wormEcosystem.addWormListener (new...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Juego de el gusanito
  • Juego Java
  • Juego java
  • Juego en java
  • Sistema experto que juega al poker- java
  • El gusanito
  • El gusanito
  • el gusanito

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS