show Jframe but not show title bar on task bar

Viewed 25538

In my application, I show a Jframe at the corner of screen for notification. And I want to show only Jframe and do not display a title bar at task bar.

How can I do that?

10 Answers

If you want the window to just appear and have neither a title bar nor appear in the taskbar, use a JWindow.

If you want the window to appear and have a title bar but to not appear in the taskbar, use a JDialog.

You could try using a JWindow instead.

Try adding a call to setUndecorated(true);. It tells the window manager to not add the title bar and window buttons.

Note: this must be called while the frame is not displayed.

One answer mentions to use JWindow which works out of the box for Windows and 2 others suggest to use javax.swing.JFrame.Type.UTILITY which is not needed in Windows if you already use JWindow. If you find yourself using JWindow under Linux and you still see it in the taskbar, you can use POPUP instead:

sWindow.setType( Window.Type.POPUP );

Read the documentation though, this might do other things as well (like removing decorations) which you might not need.

Related