topical media & game development

talk show tell print

graphic-processing-algorithm-Ch04-p96-MyControl.pde / pde



  class MyControl{
  String status = "Move";
  
    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);
      //make the buttons inteactive
      bmove.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          status = bmove.getLabel();
          println("button = " + bmove.getLabel());
        }
      }
      );
  
      brotate.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          status = brotate.getLabel();
          println("button = " + brotate.getLabel());
        }
      }
      );
  
      bscale.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          status = bscale.getLabel();
          println("button = " + bscale.getLabel());
        }
      }
      );
    }
  }
  
  


(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.