Hello All,
First thanks for taking time to read my thread. My problem is I have created a Gui Class that contains multiple JPanels inside another JPanel or ContentPane.

I have just now created another Gui2 Class in the same java project and I would like this new Gui2 Class to read and display the main JPanel or ContentPane from the original Gui Class.

I keep on getting:
Exception in thread "AWT-EventQue-0" java.lang.NullPointerException Errors

Any suggestions?
Thanks again.
Dan

The normal strategy for this is to add public methods to your Gui class that Gui2 can call to achieve whatever it is you want achieved. You may well already have a public constructor for Gui, so that may cover the "display" part.

James,

Thanks for the reply. The solution is pretty simple, not as efficient as I hoped, but it does work. I have a main class that turns on a display class that turns on the Gui1.

MAIN-->Display--> GUI1"mainJPanel"

I was hoping I could pass the just the MAIN class to Display2. MAIN--Display2-->GUI2.
Then with the MAIN I could get access to the GUI1 (mainJPanel) and display it on GUI2.

The reason for this complication is because this is leading up to an RMI solution where I will have two stations that will start RMI. Station1 will pass its MAIN to Station 2. Station 2 will then be able to grab and display anything on GUI1 if that makes sense.

Anyhow, for right now this will work. I thank you again.
Dan

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.