topical media & game development

talk show tell print

graphic-processing-algorithm-Ch09-p246-MyControl.pde / pde



  
  class MyControl extends Frame{
    String transform_type = "Move";
    String level_type = "Solid";
    Choice transform;
    Choice level;
  
    MyControl() {
      
      transform = new Choice();
      transform.addItem("Move");
      transform.addItem("Rotate");
      transform.addItem("Scale");
      transform.setLocation(0, 30);
      transform.setSize(150, 20);
  
      level = new Choice();
      level.addItem("Group");
      level.addItem("Solid");
      level.addItem("Face");
      level.setLocation(150, 30);
      level.setSize(150, 20);
  
      setSize(300, 60);
      setLocation(20, 20);
      setLayout(null);
      add(transform);
      add(level);
      show();
  
      transform.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          transform_type = transform.getItem(transform.getSelectedIndex());
        }});
      
      level.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
          level_type = level.getItem(level.getSelectedIndex());
        }});
    }
  }
  


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