I have made a class which have some warehouse stuff working fine but the thing is that now I want to make a GUI for a better code manipulation so, I have created in NetBeans a JFrame which will contain 2 JRadioButton and a jButton, I want that when a user clicks the JButton with a selected option, send a response to another JFrame with varibles I would use to call methods so, how can I extend from my warehouse class if by default, JFrame extends from javax.swing.JFrame and how can I pass some data to another JFrame? Thanks
In your first question you ask 'How do I inherit the warehouse while extending JFrame?"
The answer is, you probably don't want to extend JFrame, and may not to want inherit from warehouse, either. Instead, you probably want another class that HAS-A warehouse, and HAS-A JFrame (composition) rather than IS-A warehouse and IS-A JFrame (inheritance). This third class in your application would feed the information the JFrame needs by getting it from the warehouse.
See This JavaWorld article for an introduction to the difference between inheritance and composition, but do a more extensive search to get a better understanding.
The second question is "How to transfer data from one JFrame to another?" This will be easier when you implement the Composition approach, and will be a matter of: 1) Providing an ActionListener that gets called when the button on Frame1 is pushed 2) Getting the proper information from the warehouse 3) Sending the information to JFrame2 via whatever method calls you make available.
Joined: Jul 31, 2008
Ok I've got it, I delayed a lot to answer because I didn't understood but now it's working, Thanks!