MudButton.java
MudButton.java · 943 B
From the archive JavaMud.tar.gz
Download the archive « Back to the archive contents
import java.io.*;
import java.applet.*;
import java.awt.*;
import Mud;
class MudButton extends Button
{
String cmd = null;
Mud mud = null;
public MudButton(String name, String cmd, Mud mud) {
this.setLabel(name);
this.cmd = cmd;
this.mud = mud;
}
public boolean handleEvent(Event e){
if(e.id == e.MOUSE_DOWN){
this.mud.connection.WriteString(this.cmd +"\n");
this.mud.out.appendText(this.cmd + "\n");
//this.mud.log.appendText("["+ d + "updating...\n");
this.mud.out.appendText(this.mud.connection.ReadString() + "\n");
return true;
}
this.mud.connection.WriteString(this.cmd +"\n");
this.mud.out.appendText(this.cmd + "\n");
//this.mud.log.appendText("["+ d + "updating...\n");
this.mud.out.appendText(this.mud.connection.ReadString() + "\n");
return false;
}
}