public Component getListCellRendererComponent(
JList list, Object value, int index,
boolean isSelected,
boolean cellHasFocus) {
BeanProxy personProxy = (BeanProxy) value;
String firstName = getPropertyAsString(
personProxy, Person.FIRST_NAME);
String lastName = getPropertyAsString(
personProxy, Person.LAST_NAME);
String age = getPropertyAsString(
personProxy, Person.AGE);
String details = firstName + " " + lastName + " - " + age;
return super.getListCellRendererComponent(
list, details, index, isSelected, cellHasFocus);
}
});
JPanel buttonPanel = new JPanel();
buttonPanel.setBackground(Color.YELLOW);
gridBagConstraints.gridx = 1;
gridBagConstraints.fill = GridBagConstraints.VERTICAL;
panel.add(buttonPanel);
buttonPanel.setLayout(new GridLayout(2, 1));
JButton button;
AbstractAction addContactAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
BeanProxy proxy = (BeanProxy) contactsListProxy.addItemProxy();
EditDialog dialog = new EditDialog(new BeanComponent(gui, proxy));
dialog.show();
}
};
addContactAction.putValue(Action.NAME, "Add");