0
嗨,大家好我有一個問題讓我很困惑,我有'writeMethod'這是一個Method類,'dpv'是一個propertyDescriptor類型,我通過getWriteMethod()獲取了對象的writeMethod,我現在的問題是如何設置「writeMethod」對一個對象(例如一個JLabel,JButton的)的屬性寫在這裏是我的代碼:使用writeMethod寫入對象的屬性?
if(dpv.getPropertyType().isPrimitive()
|| dpv.getPropertyType().isInstance("Integer"))
{
Method writeMethod = dpv.getWriteMethod();
//setWriteMethod(writeMethod);<---------- Not sure about this part (doesn't work)
System.out.println(writeMethod);
PropertyValue.setEnabled(true);
SetButton.setEnabled(true);
}
else{
PropertyValue.setEnabled(false);
SetButton.setEnabled(false);
}
感謝您的幫助球員
感謝它幫助 – HAMID 2010-09-01 10:27:23