aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JLayeredPane + JPanel problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JLayeredPane + JPanel problem" Watch "JLayeredPane + JPanel problem" New topic
Author

JLayeredPane + JPanel problem

Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
I tried to overlay 2 buttons over the JLayeredPane. So that 2 buttons can be rendered over the title bar.



But the buttons' and JPanel's Z-orders are wrong, which the image is behind the Buttons, I'd like to see the image thru the JPanel's.
How can I do that?
Thanks
Jack
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2215
    
    7
Read the Swing tutorial on How to Use Layered Panes for working examples.

You need to specify an Integer value when you add components to the layered pane to control the order in which components are painted. Also I would not extend JLayeredPane. Just add compnents to it.

Post your SSCCE demonstrating the problem if you need more help.
Jacky Luk
Ranch Hand

Joined: Aug 02, 2012
Posts: 601
Rob Camick wrote:Read the Swing tutorial on How to Use Layered Panes for working examples.

You need to specify an Integer value when you add components to the layered pane to control the order in which components are painted. Also I would not extend JLayeredPane. Just add compnents to it.

Post your SSCCE demonstrating the problem if you need more help.


Got it working, by setting setOpaque to false for the JPanels
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JLayeredPane + JPanel problem