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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 580
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: 2090
    
    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: 580
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
 
Similar Threads
Swing GUI wierdness
How do read a double datatype 2D array into your applet code from a text file
create a jtable which can combine and split and the image change also
Painting components over images
gridlayout - set size