• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

design help

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got this one, thanks anyway
instead of passing objects like
"ClassName.this"
i was just passing "this"
thanks anyway
reply
    Bookmark Topic Watch Topic
  • New Topic