Hi
i'll show you several codes, the first ones work but then not, i'd like to know how to make it works ...
(thanks to iza & globos, i need not to "call" directly the class, you'll see):
///////////////////
this is the code that don't change
///////////////////
list = new String[2];
list[0] = "SCENA";
list[1] = "QUERY";
DataObjectScena = new DataObjectScena();
DataObjectQuery = new DataObjectQuery();
classList = new Object[2];
classList[0] = DataObjectScena;
classList[1] = DataObjectQuery;
public void handle (Object item) {
// item is an object that is only useful
// to decide which object-listModel i
// have to call.
for (int i=0; i<list.length; i++) {
if ( item.toString().equals(list) ) {
///////////////////
and this is the key code
///////////////////
a_JList.setListData
(((DataObjectScena)classList[0]).methods));
}}
///////////////////
it works, but always the method of DataObjectScena
///////////////////
a_JList.setListData
(classList[0].methods);
}}
///////////////////
it doesn't works
///////////////////
a_JList.setListData
(((classList[0])classList[0]).methods);
}}
///////////////////
it doesn't works, neither
///////////////////
of course i could build if ... and use (DataObjectScena)
else if ... and use (DataObjectQuery), but what about if i have 50 kinds of classes???
i'll show you several codes, the first ones work but then not, i'd like to know how to make it works ...
(thanks to iza & globos, i need not to "call" directly the class, you'll see):
///////////////////
this is the code that don't change
///////////////////
list = new String[2];
list[0] = "SCENA";
list[1] = "QUERY";
DataObjectScena = new DataObjectScena();
DataObjectQuery = new DataObjectQuery();
classList = new Object[2];
classList[0] = DataObjectScena;
classList[1] = DataObjectQuery;
public void handle (Object item) {
// item is an object that is only useful
// to decide which object-listModel i
// have to call.
for (int i=0; i<list.length; i++) {
if ( item.toString().equals(list) ) {
///////////////////
and this is the key code
///////////////////
a_JList.setListData
(((DataObjectScena)classList[0]).methods));
}}
///////////////////
it works, but always the method of DataObjectScena
///////////////////
a_JList.setListData
(classList[0].methods);
}}
///////////////////
it doesn't works
///////////////////
a_JList.setListData
(((classList[0])classList[0]).methods);
}}
///////////////////
it doesn't works, neither
///////////////////
of course i could build if ... and use (DataObjectScena)
else if ... and use (DataObjectQuery), but what about if i have 50 kinds of classes???