Results 1 to 10 of 10
Thread: linking 2 Jframes
- 01-25-2009, 08:23 PM #1
Member
- Join Date
- Jan 2009
- Posts
- 5
- Rep Power
- 0
-
I recommend that you don't use 2 JFrames, that instead your main application window be a JFrame and that the second window be a JDialog (modal or not depending on your need). You can read up on how to create and manipulate these at the Sun Swing tutorials.
- 01-26-2009, 04:12 PM #3
You can also use a single JFrame and create multiple JPanel's, each containing a particular view. You can then add and remove each panel from the JFrame, switching the one that is currently displayed.
- 01-27-2009, 12:33 AM #4
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
you can set HIDE_ON_CLOSE(in JFrame 2) instead of EXIT_ON_CLOSE :)
- 02-11-2009, 07:00 PM #5
Member
- Join Date
- Feb 2009
- Posts
- 4
- Rep Power
- 0
Or you can also set visible to false on the first jframe and visible true to the second one. Is like you are swicthing "on" the one frame and "off" the other one
pseudocode:
onButtonClick event
{
hide frame(setvisible to false)
open the second frame (call the second frame)
}
you can add afterwords a window close event where u will add a system exit in it (in the event[if window close{system exit}]).Last edited by ratb0y; 02-11-2009 at 07:03 PM.
- 02-11-2009, 07:27 PM #6
The problem with 2 JFrames is that you have two application windows. As long as they are not directly connected, that isn't terrible, but I would much rather have two tabs in one browser than two browsers. When it's an application switching between screens, then it's just annoying.
I routinely use two monitors. If I moved the first JFrame from one monitor to the second, then the second JFrame would appear on the first monitor. That's the worst case, but I hope it makes the point. GUI's should be consistent, without unnecessary flashing off and on.
On the flip side, there is seldom any reason to use two JFrame's. A JFrame and a JDialogue, for prompting purposes.
Learn to use JPanel and to manipulate the content pane. Doing things "the right way" doesn't take any more effort, once you know how, and it produces much better results.
- 02-12-2009, 03:26 AM #7
Thanks Steve :) I won't use two JFrames either now :)
>> What can be asserted without proof can be dismissed without proof. <<
- 02-12-2009, 04:09 PM #8
I found Swing very annoying at first, even though I have created hundreds of GUI's in the past. Compared to anything but C++ and Windows back in the '90's, I have not found anything so "low level". Nothing seems to work as it appears on the surface.
However, once I figured out what the underlying design, I found Swing to be powerful and fairly easy to use. Keep at it, and avoid the temptation to take short cuts (if you have time, we all face deadlines), learn MVC and use it religiously, and I think you'll find that Swing actually is quite good.
- 02-13-2009, 12:43 AM #9
Senior Member
- Join Date
- Dec 2008
- Posts
- 526
- Rep Power
- 0
well actually Steve11235 someplace right concerning to 2 browsers instead of 2 tabs ))) but if there is a real need of both JFrames you can make it. As an example I can point obfuscator Zelix Klass Master. Its GUI is just made of JFrames and still works fine ;)
So you can choose many ways for your GUI style expression...
- 02-13-2009, 01:30 AM #10
Similar Threads
-
two JFrames
By kirtesh4u in forum New To JavaReplies: 0Last Post: 11-17-2008, 08:26 PM -
Linking of exe files
By archu2friends in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 02-06-2008, 06:08 AM -
<URGENT> problem after linking .jnlp
By bongia in forum New To JavaReplies: 14Last Post: 11-18-2007, 05:57 PM -
Linking code to GUI Interface
By ai_2007 in forum Advanced JavaReplies: 1Last Post: 07-02-2007, 01:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks