All pastes #208919 Raw Edit

Anonymous

public java v1 · immutable
#208919 ·published 2006-10-18 21:57 UTC
rendered paste body
import javax.swing.*;import java.awt.*;public class Kort extends JButton {		private Icon bild;	enum Status {DOLT, SYNLIGT, SAKNAS};	Status s;		public Kort(Icon i) {		bild = i;		s = Status.SAKNAS; 		farg();	}		public Kort(Icon i, Status a) {		bild = i;		s = a;		farg();	}			public Status getStatus() {		return s;	}			public void setStatus(Status a) {			s = a;			farg();	}		public Kort copy() {		return new Kort(this.bild, this.s);	}		public boolean equals(Kort k) {		if(k.bild == this.bild) {		return true;		}		else {		return false;			}	}	public void farg() {		if(s == Status.DOLT) {			setIcon(null);			setBackground(Color.BLUE);		}		else if(s == Status.SYNLIGT) {			setIcon(bild);		}		else if(s == Status.SAKNAS) {			setIcon(null);			setBackground(Color.WHITE);		}	}}