-
Switching Frames (windows)
How do you switch from 1frame to the other 
This is the problem:
I've got 2 frames (frame1.java and frame2.java) what I want to do is switch between these frames (later on there will be more frames)
So my question is: How do I close the current window, and activate the next one, by clicking a button.
I did found some things with commands like: frame1.show() and frame1.hide()
But these wont work.
All the frames are already programmed, I only need to put the command in the Actionhandler to switch from one to another.
Please help me.
THNX for da Reading
-
i dont really use more than one frame but you should just be able to do this:
Code:
public void actionPerformed(ActionEvent e)
{
frame1.hide();
frame2.show();
//or
//frame1.setVisible(false);
//frame2.setVisible(true);
}
hopefully that does something close to what you need...
-
Code:
public void actionPerformed(ActionEvent e)
{
frame1.hide();
frame2.show();
//or
//frame1.setVisible(false);
//frame2.setVisible(true);
}
I already tried this, it gives an error
"Frame1.java": Error #: 308 : non-static method setVisible(boolean) cannot be referenced from a static context at line 129, column 8
And I dont know what it means, I've tried importing Frame 2 , but that didnt work either.
I can say
Frame2 frame2 = new frame2();
this way it does create the next frame, but I cant go back
becouse it only works with this.setVisible() and not frame2.setVisible()
Please what else do I need to do, to get this code working...
THNX for da Reading
-
Your error message tells me that your issue has to do with the way you have structured your program (have you created an instance of your class, and are manipulating that instance's frames?), not how you are trying to implement the frame switching.
The diagnosis of this problem would require looking at more (if not all) of your code, not just this specific issue
[This is why it is important to pass on compiler/run time error messages when asking a question like this on a forum like this]
Similar Threads
-
By jobartley515 in forum VB Classic
Replies: 3
Last Post: 10-28-2005, 08:33 PM
-
By Gwen Smith in forum vb.announcements
Replies: 0
Last Post: 04-28-2003, 02:37 PM
-
By Dennis in forum VB Classic
Replies: 10
Last Post: 02-15-2001, 03:52 AM
-
By Paul Clapham in forum Java
Replies: 0
Last Post: 11-30-2000, 11:14 AM
-
Replies: 0
Last Post: 11-29-2000, 05:15 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks