Results 1 to 6 of 6
Thread: GUI. Button opening another GUI
- 12-02-2010, 03:33 PM #1
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
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!
- 12-02-2010, 04:11 PM #2
Member
- Join Date
- Dec 2010
- Posts
- 49
- Rep Power
- 0
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.
- 12-02-2010, 04:20 PM #3
- 12-02-2010, 05:00 PM #4
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
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.Last edited by Felic; 12-02-2010 at 05:03 PM.
- 12-02-2010, 07:18 PM #5
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.
But for the "swap method", check out CardLayout: How to Use CardLayout (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)
- 12-02-2010, 07:52 PM #6
Member
- Join Date
- Dec 2010
- Posts
- 6
- Rep Power
- 0
I will take a look at it.
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).
Anyway, I'll take a look at your link now. Ty for your help so far!
Similar Threads
-
Reg Java Opening
By krishnash in forum Jobs WantedReplies: 0Last Post: 02-07-2010, 12:58 PM -
[HELP]JButton opening a browser and opening a website[HELP]
By Learnin in forum AWT / SwingReplies: 4Last Post: 10-07-2009, 10:14 AM -
opening ports
By prashant in forum NetworkingReplies: 2Last Post: 03-22-2009, 09:23 PM -
Opening a workspace twice
By javaplus in forum EclipseReplies: 0Last Post: 01-08-2008, 10:56 AM -
Opening URLConnection
By Java Tip in forum Java TipReplies: 0Last Post: 11-24-2007, 08:37 PM
Bookmarks