GUI. Button opening another GUI

Hi there

I recently started at a university where we have to spend the first 3 semesters learning a bit of Java. Now I have a project where I need to create a GUI for some classes about the weather.

My question is, we have a GUI made with WindowBuilder from Google with a main method in it. We want this GUI to have a button (which we already made) that opens up another window (that we made in another class with the WindowBuilder, wich means it also has a main method which probably needs to be removed).

How do you refer or get a button to open a new GUI class? Any help is appreciated!

As a user I hate applications that opens multiple windows and make it difficult and confusing which one is in use.
As a programmer I tell you that you can re-use frame of your application and re-fill it with new content. You will simple swap one panel in frame with new panel.

As a user I hate applications that opens multiple windows and make it difficult and confusing which one is in use.
As a programmer I tell you that you can re-use frame of your application and re-fill it with new content. You will simple swap one panel in frame with new panel.

Well I am pretty clueless, as I said I am new to this. We only had Java for 2 months and we already have to create a project and turn it in for examination the 16th. We'll only have Java for around 1 year total, then we'll proceed to Databases and a more managerial perspective of IT and Project Management. But I'd like to actually know what I am doing still, which is why I even came here in the first place.

A swap method could work, it sounds clever atleast. I just need some pointers. At the moment I created 2 GUI's in each their class. When you use WindowBuilder it automatically creates a main method in each of the classes, and to my knowledge that won't work if you try to open another GUI with a main method in it??

Could you perhaps give or link me to an example that uses a simple swap method from 1 GUI window to another ? Anything would be appreciated. I could try to provide some more details if you want aswell.

Honestly, I'd recommend you ditch the GUI builder until you're more comfortable with programming in general. I promise you're only hurting yourself by trying to learn programming and how the GUI builder works at the same time.

Honestly, I'd recommend you ditch the GUI builder until you're more comfortable with programming in general. I promise you're only hurting yourself by trying to learn programming and how the GUI builder works at the same time.

Well the problem is we HAVE to turn in the paper like that. Basicly the description was:

Create 3 classes constisting of 1/2 get/set methods describing Wind/Rain/Temperature. A 4th class Collecting it all and creating a method for statistics, min/max temp and a reset button that sets them all to 0.

The 5th class is the GUI where the data is shown and it has to have working buttons showing the data. So our GUI have to be able to swap to the statistic page showing min/max temp and amount of rain (data that we just give, when we expand we will make the user able to give the input in a textfield).