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 +------+
source share