简体   繁体   中英

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?

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.

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

Use CardLayout for switching between components, or use JDialog instead of new JFrame 's.

Also read about using of multiple frames .

Try This example. Also see JInternalFrames

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM