How can I implement the tray that appears on the controls?

I have a screen like this:

+--------+---------------------+ |___A____| | |________| JComponent I am | |________| drawing on | |________| __ __ | |________| | | | |________| | |________| \__________/ | |________| | |________| | |________| | +--------+---------------------+ 

And I would like to make the tray pop out on top of the JComponent when I press the A button, on which I draw? What is the best way to implement this? By ignoring the layout manager and adding it to my JComponent, which I use as a canvas or some kind of layered panel?

 +--------+---------------------+ |___A____|_Tray__| | |________| JComponent I am | |________| drawing on | |________| __ __ | |________| | | | |________| | |________| \__________/ | |________| | |________| | |________| | +--------+---------------------+ 

To distinguish between JPopupMenu and the proposed tray.

 +------+--------------------+ |Button| +------+ | | <--- JPopupMenu +------+ +------+--------------------+ |Button|____________| <----- Tray +------+ 
+4
source share
1 answer

It seems that JToolBar is best suited as it can be configured for horizontal or vertical layout.

0
source

All Articles