ton1
ton1

Reputation: 7628

How can I create new JFrame without adding a new task in task bar

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

Answers (4)

ravibagul91
ravibagul91

Reputation: 20755

Try This example. Also see JInternalFrames

Upvotes: 0

alex2410
alex2410

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

Radu Murzea
Radu Murzea

Reputation: 10900

The recommended approach is to use a JDialog. This will not create a new task in your taskbar.

Upvotes: 2

jzd
jzd

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

Related Questions