Ok, I have the ever popular Inventory Program in a JAVA class going on. I have successfully created a new class to hold the GUI information. I have the window sized and the title of the window placed. When I run the program the GUI shows up. Next I need to add controls to the window. These are in other classes and I'm having trouble figuring out how to link the controls to the class I need to pull from.

I did not post my code because I'm just asking a question and only want to be pointed in the direction :) I know this is little information and hope its enough to get me going.

Recommended Answers

All 2 Replies

You can call myGuiWindow.add(component); from any class as long as it has a reference to the window.

Or if you have a class that contains all your custom components and you want to add these to your current container. Make them all static, and then:

add(MyClass.button1)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.