import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; /*This is a basic class for a rectangular button button*/ public class ListenSquare { double x,y,w,h; int on; Color C; /*square*/ public ListenSquare(double x,double y,double r,Color C) { this.x=x; this.y=y; this.C=C; this.w=r; this.h=r; this.on=0; } /*rectangle*/ public ListenSquare(double x,double y,double w,double h,Color C) { this.x=x; this.y=y; this.C=C; this.w=w; this.h=h; this.on=0; } public int inside(Point p) { int test=0; if((p.x>x)&&(p.xy)&&(p.y=1) g.setColor(CC); g.fillRect((int)(x),(int)(y),(int)(w),(int)(h)); g.setColor(C); if(on==1) g.setColor(Color.white); g.drawRect((int)(x),(int)(y),(int)(w),(int)(h)); } public void render2(Graphics g,Color CC) { g.setColor(CC); g.fillRect((int)(x),(int)(y),(int)(w),(int)(h)); g.setColor(new Color(20,20,20)); g.drawRect((int)(x),(int)(y),(int)(w),(int)(h)); } }