troubleshooting Question

How do I pass an object through a constructor?

Avatar of CharleneS77
CharleneS77Flag for United States of America asked on
7 Comments1 Solution186 ViewsLast Modified:
I have a SodaMachineWindow class with a main method that creates a sodaMachineWindow.
I have a LeftPanel class and a RightPanel class. A leftPanel and rightPanel are added to the sodaMachineWindow.
I have a ComponentPanel class.  A componentPanel is added to the leftPanel.
I have a ImagePanel class.  An imagePanel is added to the rightPanel.

I am attempting to use a button in the componentPanel to display a painted icon on the imagePanel.
I have instantiated an ImagePanel object in my SodaMachineClass.  
I need to pass the ImagePanel object down to the ComponentPanel through the constructors so I have a reference to the real ImagePanel inside my ComponentPanel class.  
How do I accomplish this?
Muhammad Khan
Manager, IT

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros