Hi folks I'm having the problem of invoking a property of an object(e.g. JButton) by using readMethod() of reflection class, any ideas are much appreciated? here is the code:
private void PropertySelectedFromList(java.awt.event.ActionEvent evt) {
// add code here
String propertyName = (String)PropertyList.getSelectedItem();
PropertyType.setEnabled(true);
PropertyType.setText("Text" + propertyName);
PropertyValue.setEnabled(true);
PropertyDescriptor dpv = PropValue(props, propertyName);
Method readMethod = dpv.getReadMethod();
if(readMethod != null){
String obtName = (String) ObjectList.getSelectedItem();
Object ob = FindObject(hm, obtName);// retrieving object from hashmap
aTextField.setText(readMethod.invoke(ob, ???));<----------here is the problem
}
else{
PropertyValue.setText("???");
}
Method writeMethod = dpv.getWriteMethod();
if(writeMethod != null){
System.out.println(writeMethod);
}
else{
System.out.println("Wrong");
}
}