• Post Reply Bookmark Topic Watch Topic
  • New Topic

swing applet problem  RSS feed

 
Shailesh Ligade
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet which consist of two JPanel, which I have subclassed. The left panel has a JTree in it, and right panel has bunch of buttons. Righ panel class also implements actionlistner for all the buttons.
The actionlinstner needs to do the things which needs the information from tree, e.g selected node etc.
What is the best way to pass the tree information to right panel, besides passing entire left panel or jtree via constructor. GetParent() on right panel only gives me another JPanel and not the class which defines the applet..I wonder why?
Appreciate any help.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to access other members (in addition to the JTree) or methods inside the TreeStore class then you could pass a reference to it (treeStore) into the ButtonStore class instead of the JTree reference (as shown in the code below).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!