| Author |
design help
|
KunkalaGuntala Samba Siva Rao
Greenhorn
Joined: Nov 06, 2003
Posts: 20
|
|
looks big, but the question context is in "passing object references only by value" PCPanel1 p1 = new PCPanel1(data1); p1.addComp2(); i have trouble passing the PCMainPanel object also here so that it can be called back by the back button using the reference (oops...reference passed by value..) how to acheive this without creating one more instance or clone() ---------------------------------------------------------------------------
|
 |
KunkalaGuntala Samba Siva Rao
Greenhorn
Joined: Nov 06, 2003
Posts: 20
|
|
I couldn't use cordlayout for some reasons, so i am trying to simulate a back button without creating many instances.. ie my first screen is invoked like this in Frame class public void launchMainPanel() { System.out.println("Launch main panel"); mainPanelClass = new PCMainPanel(DataClass); mainPanelClass.addComp1(); } my second screen is invoked like this in another class PCPanel1 p1 = new PCPanel1(data1); p1.addComp2(); ??? PCPanel1 p1 = new PCPanel1(data1, ???); ??? i have trouble to get this object here and pass it on to the next class... i am trying to think how to pass the mainPanelClass to another class so that when back button is clicked i can call the method back without creating one more instance btnBack.addActionListener(new ActionListener () { public void actionPerformed(ActionEvent e) { mainPanel.addComp1(); } }); --------------- so finally i need a back button working without creating more than one instance of same class
|
 |
KunkalaGuntala Samba Siva Rao
Greenhorn
Joined: Nov 06, 2003
Posts: 20
|
|
i got this one, thanks anyway instead of passing objects like "ClassName.this" i was just passing "this" thanks anyway
|
 |
 |
|
|
subject: design help
|
|
|