• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JLayeredPane + JPanel problem

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2599
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic