TextFieldPanel.java


import java.awt.*;
import java.awt.event.*;

public class TextFieldPanel 
    extends Panel 
    	implements 
    	    ActionListener, 
    	    AddressSettable{
    TextField t0 = 
    	new TextField("my number vc");
    TextField t1 = 
    	new TextField("203-454-1234 fax");
    TextField t2 = 
    	new TextField("203-543-2134 cell");
    	
    public void actionPerformed(
    	ActionEvent e) {
    	System.out.println(
    	    "command="
    	    +e.getActionCommand()
    	);    	
    }
    public void setAddress(AddressRecord a) {
    	t0.setText(a.getPhone1());
    	t1.setText(a.getPhone2());
    	t2.setText(a.getPhone3());
    }
    
    TextFieldPanel() {
    	setLayout(
    	    new GridLayout(0,1));
    	add(t0);
    	add(t1);
    	add(t2);
    	t0.addActionListener(this);
    	t1.addActionListener(this);
    	t2.addActionListener(this);

    	}
}

[Back to Index]
This document was generated automatically by Kahindu.
Kahindu