P
Patrick Goovaerts
Hi,
I am trying to build a menu with applications. I need to instantiate/set
applicationobjects for each application in the menu (sounds logic). I
wonder if it is possible to do this 'dynamically'. I mean, when i have a
list (from database) of applications, is it possible to create each object
without adding code over and over for each new app? This would allow me to
add a new application to a database without changing the code in the
menuapp.
Example:
Now i have:
// application 1
if
((jTree.getLastSelectedPathComponent().toString()).equals("FrameTestje")){
if (myFrameTestje==null){
myFrameTestje = new testInternalFrame();
createPanel(myFrameTestje);
}
activatePanel(myFrameTestje);
}
// application 2
if
((jTree.getLastSelectedPathComponent().toString()).equals("PanelTestje")){
if (myPanelTestje==null){
myPanelTestje = new testApp();
createPanel(myPanelTestje);
}
activatePanel(myPanelTestje);
}
... // application x
I want something like this:
if
((jTree.getLastSelectedPathComponent().toString()).equals("anAppName")){
if (anAppName==null){
anAppName = new anAppName();
createPanel(anAppName);
}
activatePanel(anAppName);
}
thanks
I am trying to build a menu with applications. I need to instantiate/set
applicationobjects for each application in the menu (sounds logic). I
wonder if it is possible to do this 'dynamically'. I mean, when i have a
list (from database) of applications, is it possible to create each object
without adding code over and over for each new app? This would allow me to
add a new application to a database without changing the code in the
menuapp.
Example:
Now i have:
// application 1
if
((jTree.getLastSelectedPathComponent().toString()).equals("FrameTestje")){
if (myFrameTestje==null){
myFrameTestje = new testInternalFrame();
createPanel(myFrameTestje);
}
activatePanel(myFrameTestje);
}
// application 2
if
((jTree.getLastSelectedPathComponent().toString()).equals("PanelTestje")){
if (myPanelTestje==null){
myPanelTestje = new testApp();
createPanel(myPanelTestje);
}
activatePanel(myPanelTestje);
}
... // application x
I want something like this:
if
((jTree.getLastSelectedPathComponent().toString()).equals("anAppName")){
if (anAppName==null){
anAppName = new anAppName();
createPanel(anAppName);
}
activatePanel(anAppName);
}
thanks