All pastes #948844 Raw Edit

tre

public text v1 · immutable
·published 2008-03-19 13:50 UTC
rendered paste body
public class ContactView extends JPanel {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private Contact refContact;
    private JLabel name;
    private JLabel tel;

    // todo more stuff

    public ContactView(Contact contact) {
        if (contact != null) {
            this.refContact = contact;
            this.setLayout(new GridLayout(3,1));
            this.name = new JLabel(contact.getName() + ", "
                    + contact.getVorname());
            this.name.setBackground(Color.darkGray);
            this.name.setFocusable(true);

            this.tel = new JLabel(contact.getTel());
            this.tel.setFocusable(true);
            this.add(this.name);
            this.add(this.tel);
        }
    }

    public void addActionListener(ActionListener acl) {
        this.addActionListener(acl);
    }
    public void update(){
        this.name.setText(this.refContact.getName());
        this.tel.setText(this.refContact.getTel());
    }
}