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
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL