How to get GUI panels out of another class?
I'm working on a little app that has several Product classes, and a sort of "manager" class. Each product class has a range of GUI panels, eg "Add New Product Panel", and "Edit Product Panel".
What I want to do is call these panels from the "manager" class - so for example, if the user clicks the "edit product" button, the edit product panel is opened up in the main content pane.
I'm having a bit of a battle with it - I want to keep the panels in their corresponding classes, but it seems that doing it that way, my only option is to make each panel a method, so I can call that method from the manager class. That leasds to a host of problems which I won't go into, but I'd appreciate any ideas on a better way to do it.
The usual way for geting objects from other classes is with the use of getter methods. so in your case that would be a method similar to getEditProductPanel, with the necessary parameters. Once you are done with the panel, and have entered all the data that needs entering, you can put it back in the editProject object via a setter method, setEditProductPanel. This method would then be responsible for handling all the data entered into the panel.
Ah, that's basically the set up I had - I just wondered if I was going a bit off the rails. THanks for the reply, I can crack on now
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center