?? drawnwmodel.java
字號(hào):
import java.awt.Shape;
import java.io.Serializable;
import java.util.*;
public class DrawNwModel implements DrawModel,Serializable {
// ArrayList changeListeners = new ArrayList(10);
NwClient nwClient;
/** Creates new BrokerNwImpl */
public DrawNwModel(NwClient nwClient) {
this.nwClient=nwClient;
}
public void addModelChangeListener(DrawCanvas c)
{ }
public void setSel(int x){
Command cmd;
Object result;
try {
cmd=new SetSelCommand(x);
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result = cmd.getResult();
} catch(Exception e) { }
}
public void setP1(int x,int y){
Command cmd;
Object result;
try {
cmd=new SetP1Command(x,y);
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result = cmd.getResult();
} catch(Exception e) { }
};
public int getP1x(){
Command cmd;
int result=0;
try {
cmd=new GetP1xCommand();
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result =Integer.parseInt(cmd.getResult().toString());
} catch(Exception e) {}
return result;
}
public int getP1y(){
Command cmd;
int result=0;
try {
cmd=new GetP1yCommand();
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result =Integer.parseInt(cmd.getResult().toString());
} catch(Exception e) {}
return result;
}
public ArrayList<SubShape> getShapes(){
Command cmd;
Object result;
ArrayList<SubShape> list= new ArrayList<SubShape> ();
try {
cmd=new GetShapesCommand();
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result = cmd.getResult();
list=(ArrayList<SubShape>)result;
} catch(Exception e) {}
return list;
}
public void addShapes(SubShape shape){
Command cmd;
Object result;
try {
cmd=new AddShapesCommand(shape);
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result = cmd.getResult();
} catch(Exception e) { }
}
public ArrayList<SubShape> deletShapes(){
Command cmd;
Object result;
ArrayList<SubShape> list= new ArrayList<SubShape>();
try {
cmd=new DeletShapesCommand();
nwClient.send(cmd);
cmd = (Command) nwClient.receive();
result = cmd.getResult();
list=(ArrayList<SubShape>)result;
} catch(Exception e) {}
return list;
}
public ArrayList<SubShape> add(int x1,int y1,int x2,int y2){
Command cmd;
Object result;
ArrayList<SubShape> list= new ArrayList<SubShape>();
try {
cmd=new AddCommand(x1,y1,x2,y2);
nwClient.send(cmd);
cmd = (AddCommand) nwClient.receive();
result = cmd.getResult();
list=(ArrayList<SubShape>)result;
} catch(Exception e) {}
return list;
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -