0

When writing java programs with a gui I find that it quickly becomes messy with passing pointers to different components through constructors. I was wondering if this is the best or only way to link components or if there is a more common design pattern for this.

e.g I have a toolbar inside of a panel which needs to interact with a panel inside of that panel.

Thanks

Virus7711
  • 27
  • 1
  • 5
  • no pointers in java and share some code. – Deepanshu J bedi Jul 27 '14 at 11:38
  • 2
    Do some research on MVC Pattern (simple [example from trashgod](http://stackoverflow.com/q/3066590/2587435)). Also Do some research on the Observer pattern. They are similar in ways. Choose the one best fitting, once you grasp both concepts – Paul Samsotha Jul 27 '14 at 11:42
  • Swing itself illustrates many common [patterns](http://stackoverflow.com/q/1673841/230513); you're looking for the observer pattern. See also [*How to wire one JPane to another JPane*](http://stackoverflow.com/q/10523343/230513). – trashgod Jul 27 '14 at 11:44

0 Answers0