Angel.java

   1 /**
   2  * @author Juan David Marin
   3  */
   4 
   5 import java.awt.Color;
   6 import java.awt.Font;
   7 import java.awt.Graphics;
   8 import java.io.Serializable;
   9 
  10 public class Puntaje extends ObjetoGrafico implements Serializable{
  11         private static final long serialVersionUID = -4720854291573720165L;
  12         private long cantidad;
  13         private String nombre;
  14 
  15         public Puntaje(int x,int y,int an,int al,Color c){
  16                 super (x, y, an, al);
  17                 cantidad = 0;
  18                 nombre = null;
  19         }
  20         
  21         public Puntaje(Puntaje puntaje){
  22                 super (puntaje.getposX(), puntaje.getposY(), puntaje.getancho(), puntaje.getalto());            
  23                 cantidad = puntaje.cantidad;
  24                 nombre = new String(puntaje.nombre);
  25         }
  26         
  27         public void paint (Graphics g){ 
  28                 g.setColor(Color.white);
  29                 g.setFont( new Font( "Arial", Font.BOLD, 25 ) );
  30                 g.drawString(" SCORE "+ nombre + " = " + cantidad, getposX (), getposY());
  31         }
  32          
  33         public void add (int n){
  34         cantidad += n;
  35         }
  36         public long getCantidad() {
  37                 return cantidad;
  38         }
  39 
  40         public void setCantidad(long cantidad) {
  41                 this.cantidad = cantidad;
  42         }
  43 
  44         public String getNombre() {
  45                 return nombre;
  46         }
  47 
  48         public void setNombre(String nombre) {
  49                 this.nombre = nombre;
  50         
  51                 
  52         }
  53         
  54 }

CategoryJava | CategoryProgramacion


CategoryProgramacion

Java/Angel/Puntaje.java (last edited 2009-05-20 14:02:18 by Juan David Marin Useda)