1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
private Object bean;
private PropertyChangeSupport support = new PropertyChangeSupport(this);
/** Creates new customizer OkCancelCustomizer */
public OKCancelCustomizer() {
initComponents();
}
public void setObject(Object bean) {
this.bean = bean;
message.setText(bean.getClass().toString());
}
private void initComponents() {
(...)
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
/* setting datas into bean */
if (this.bean instanceof OKCancel) {
this.message.setText("Should be ok ! :" + ((OKCancel) bean).getCancelButtonText());
((OKCancel) bean).setOkButtonText(this.fieldOK.getText());
((OKCancel) bean).setCancelButtonText(this.fieldCancel.getText());
} else {
this.message.setText("Argghh !");
}
/* fire properties */
support.firePropertyChange("okButtonText", null, this.fieldOK.getText());
support.firePropertyChange("cancelButtonText", null, this.fieldCancel.getText());
} |
Partager