4

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
+------+
davidahines
  • 3,976
  • 16
  • 53
  • 87
  • Whats a tray? I would guess you can just use a JDialog or JPopupMenu. – camickr Apr 21 '11 at 15:06
  • A sideways popup menu. Like a JPopupMenu but sideways. – davidahines Apr 21 '11 at 15:14
  • Yup, but I'm not looking for a dropdown, I'm looking for a tray, not something layed out vertically with just text, something layed out horizontally. I want to be able to add a panel that will appear above the canvas so that I can give it flow layout with text + imageicons similar to the way that photoshop allows you to select which brush, marquis, etc upon clicking a particular tool. – davidahines Apr 21 '11 at 15:58
  • [`JToolBar`](http://download.oracle.com/javase/tutorial/uiswing/components/toolbar.html) pops out on most L&Fs. – trashgod Apr 21 '11 at 16:25

0 Answers0