MyCanvas With TextEvents
class MyCanvas extends Canvas
implements ActionListener, TextListener {
green.addActionListener(this);
shapeSpec.addTextListener(this);
public void paint(Graphics g) { ••• }
public void actionPerformed(ActionEvent e) { ••• }
public void textValueChanged(TextEvent e) {
if (shapeSpec.getText().equals("oval") ||
shapeSpec.getText().equals("rect"))
// instance variables •••