Two Laptop Bag
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: 631
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: 2372
    
    8
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: 631
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
 
Have you checked out Aspose?
 
subject: JLayeredPane + JPanel problem
 
It's not a secret anymore!