Results 1 to 4 of 4
Thread: Frame doesn't appear
- 12-25-2009, 11:53 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 4
- Rep Power
- 0
Frame doesn't appear
Hello,
I'm trying to make a button that when pressed it shows another frame (CustomerOrder) and hides the current one.
private void btnDoneActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
new CustomerOrder.setVisible(true);
}
It's not working, only the current frame hides and nothing happens.
Any ideas what the problem could be ?
-
This should cause a compiler error, right?:
Better perhaps is:Java Code:new CustomerOrder.setVisible(true);
Having said this, I much prefer swapping JPanels via a CardLayout than swapping JFrames.Java Code:new CustomerOrder().setVisible(true);
BTW, welcome to the forum.
- 12-27-2009, 02:17 AM #3
Good advice from F7e regarding CardLayout. As far as chaining method calls... Java obviously allows it, and it's not wrong, but it makes debugging your program more difficult. If adding the () to CustomerOrder fixed the problem, pls mark your post as solved.
- 12-27-2009, 08:36 AM #4
Member
- Join Date
- Dec 2009
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Returning focus to a frame after hiding another frame
By fletcher in forum AWT / SwingReplies: 7Last Post: 11-02-2009, 06:31 PM -
frame as an applet
By shruti in forum Java AppletsReplies: 0Last Post: 07-18-2009, 11:32 AM -
GUI new frame
By billbo123 in forum New To JavaReplies: 15Last Post: 03-02-2009, 04:24 AM -
frame
By arunkumarinfo in forum NetBeansReplies: 0Last Post: 02-07-2009, 10:26 AM -
Frame to other Frame
By Aswq in forum New To JavaReplies: 2Last Post: 07-19-2008, 04:27 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks