Reputation: 7628
I don't know what should I say, There is a JFrameOne
has show
button. When I click show
Button, The New JFrame (JFrameTwo
) will show up. It works well. But the problem is, in the task bar ( the bottom of the your desktop ) , new task added. JFrameTwo
. Finally, I can see 2 tasks (JFrameOne
, JFrameTwo
) in the task bar. This is not what I'm going to do. This is abnormal I think, You know, When I click the button in Ecilpse or anything usual program, they nothing create new task in task bar. They just show frame without create any task.
So, I read some tutorials about Swing, related creating new window, People say I should use JDesktopPane+JInternalFrame or Card Layout. But, the JFrameTwo is bigger than JFrameOne. In this situation, what should I do?
Upvotes: 1
Views: 138
Reputation: 10994
Use CardLayout
for switching between components, or use JDialog
instead of new JFrame
's.
Also read about using of multiple frames.
Upvotes: 1
Reputation: 10900
The recommended approach is to use a JDialog
. This will not create a new task in your taskbar.
Upvotes: 2
Reputation: 23629
Use JDialog instead of a JFrame. A JDialog will not create new items in the task bar. Possibly even make the dialog modal to make it easier on the user.
If your first Frame is much smaller than the second frame you want to open, you might want to rethink your GUI and possibly make the first frame larger and use a JDesktop like you mention or just update the content of a single frame.
Upvotes: 2