开发者

How do I go about implementing a tray that appears on controls?

开发者 https://www.devze.com 2023-02-28 11:14 出处:网络
I have a screen like so: +--------+---------------------+ |___A____|| |________| JComponent I am| |________|drawing on|

I have a screen like so:

+--------+---------------------+
|___A____|                     |
|________| JComponent I am     |
|________|  drawing on         |
|________|    __        __     |
|________| 开发者_开发问答    |        |      |
|________|                     |
|________|    \__________/     |
|________|                     |
|________|                     |
|________|                     |
+--------+---------------------+

And I would like to make it so that when I click the button A a tray is popped up over top of the JComponent I am drawing on? How best to implement this? Through ignoring the layout manager and adding it to my JComponent that I'm using as a canvas or some kind of layered pane?

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

To manke the distinction between JPopupMenu and the proposed tray.

+------+--------------------+
|Button|
+------+
|      |  <--- JPopupMenu
+------+

+------+--------------------+
|Button|____________|  <----- Tray
+------+
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号