topical media & game development
graphic-processing-algorithm-Ch04-p95-p95.pde / pde
class MyControl{
String status = "Move"; //initialize a variable status
Button bmove; //three buttons
Button brotate;
Button bscale;
MyControl(){
bmove = new Button("Move"); //create the buttons
brotate = new Button("Rotate");
bscale = new Button("Scale");
add(bmove); //add them to the screen
add(brotate);
add(bscale);
bmove.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
status = bmove.getLabel();
}
}
);
brotate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
status = brotate.getLabel();
}
}
);
bscale.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
status = bscale.getLabel();
}
}
);
}
}
MyControl control = new MyControl();
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.