[JAVA - JLabel] executing a method based on contents of the variable
hi
i have a class which had a JPanel a JLabel and a JTextField ....
it has constructor methods for intializing the text of label and text field ...
it has set methods and get methods for setting and getting text, etc
the problem is ... i need this class to be generic ... i dont want to and i cant sit down and code all the possible methods for a JLabel object. i want to have a set method which accepts teo strings where the 1st is the property name like setBackground or setBounds and the second one is the parameters to be passed to the method
eg
if i need
label.setBackGround(Color.WHITE)
i want to call a function
setLabel (String a, String b)
where a = "setBackGround"
and b = "Color.White"
if i need
label.setBounds(10,10,100,20)
i want to call a function
setLabel(String a, String b)
where a = "setBounds"
and b = "10,10,100,20"
thanks a lot
|