0

I have a main class (Main.java) who extends JFrame.

Main class containt a left panel who contain two panels. The first one (Component) contain many TabelPanel and the second is named Property.

I have a center panel (design) and a bottom panel who contain a button. The design panel contain a jtree.

I take element from component panel and a do drag and drop to jtree. When i select a element in the jtree, i need to display information to the property panel.

When i click in the bottom (bottom panel), i need to iterate to jtree panel.

Instead to have reference everywhere, what is the best way to avoid that?

redfox26
  • 2,020
  • 4
  • 25
  • 33
  • 2
    1) Make sure to create separate classes for your separate functionalities. 2) Each collection of classes, JPanel and its logic should obey MVC or one of its variants. 3) Try to make each class as independent as possible using listeners such as PropertyChangeListeners and SwingPropertyChangeSupport to loosen coupling as much as possible. 4) Use interfaces for the same purpose to loosen coupling and allow for easier independent mocking and testing. – Hovercraft Full Of Eels Nov 24 '12 at 14:41
  • If you need more specific advice, consider creating and posting an [sscce](http://sscce.org) that illustrates in miniature your problem. The sscce can have multiple classes, but all go in one file, and that's the only class that is public. – Hovercraft Full Of Eels Nov 24 '12 at 15:28
  • [crossposted](http://www.coderanch.com/t/598701/GUI/java/split-component-communication) – mKorbel Nov 25 '12 at 16:37

0 Answers0