colorButton.setBackground(option.getValue());
return colorButton;
}
private Component createDateComponent(final DateOption option) {
final JXDatePicker result = new JXDatePicker();
result.setDate(option.getValue());
result.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
option.setValue(((JXDatePicker)e.getSource()).getDate());
}
});
if (option instanceof ChangeValueDispatcher) {
((ChangeValueDispatcher)option).addChangeValueListener(new ChangeValueListener() {
public void changeValue(ChangeValueEvent event) {
assert event.getNewValue() instanceof Date;
result.setDate((Date) event.getNewValue());
}
});
}
return result;