Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a JPanel contained in a JDesktopPane as always on top

Tags:

java

swing

jpanel

I know this is a simple procedure with JInternalFrame, but can it be done with a measly JPanel?

like image 310
farm ostrich Avatar asked Aug 16 '11 14:08

farm ostrich


2 Answers

If the tool bar is sitting across one of the sides of the GUI, why try to add the toolbar directly to the JDesktopPane? Why not hold everything in a JPanel that uses BorderLayout, add the JDesktopPane to this JPanel BorderLayout.CENTER and add the toolbar to the JPanel BorderLayout.WHATEVER (depending on where you want to place it)?

like image 153
Hovercraft Full Of Eels Avatar answered Nov 09 '22 15:11

Hovercraft Full Of Eels


Instead of JPanel for your toolbar, consider JToolBar in conjunction with Action. Conveniently, a JToolBar is detachable on most platforms. There are related examples here and here.

like image 21
trashgod Avatar answered Nov 09 '22 15:11

trashgod