class MyControl{ String status = "Move"; Button bexit; Choice transform; Label coordsDisplay; TextField input; MyControl() { //*** Button setup bexit = new Button("Exit"); bexit.setLocation(width-50, height-30); bexit.setSize(40, 20); //*** Label setup coordsDisplay = new Label(); coordsDisplay.setLocation(10, height-30); coordsDisplay.setSize(100, 20); //*** TextField setup input = new TextField("Welcome"); input.setLocation(10, height-60); input.setSize(width-20, 20); //*** Choice setup transform = new Choice(); transform.addItem("Move"); transform.addItem("Rotate"); transform.addItem("Scale"); transform.setLocation(width/2-50, 0); transform.setSize(100, 40); //*** Screen setup setLayout(null); //use the user specified size and location add(transform); add(coordsDisplay); add(input); add(bexit); transform.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { status = transform.getItem(transform.getSelectedIndex()); control.input.setText(status); }}); bexit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); }}); input.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { println("textfield = " + input.getText()); }}); } }