This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JLayeredPane vs JPanel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JLayeredPane vs JPanel" Watch "JLayeredPane vs JPanel" New topic
Author

JLayeredPane vs JPanel

Micah Pezdirtz
Greenhorn

Joined: Aug 14, 2006
Posts: 25
i want to use a JLayeredPane because you can put things at different depths. but i recently found that JPanel also has some sort of layer positioning system. what is up with this? is JLayeredPane just an easy way to use the layers that are already in JPanel? what makes JLayeredPane's jayers better than JPanels layers? somebody straighten me out about this please.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Interesting observation. Though I don't think JPanels are really layered. At least not like JlayeredPanes. Personally, the only time I have used a JLayeredPane is for a pallette which I needed to float above all other layers.

See, if you wanted to use a JPanel for such things, you would basically have to create a focus listener and pop the JPanel to the front anytime it lost focus. with a JLayeredPane you simply specify the "z-order" and java takes care of the rest.


GenRocket - Experts at Building Test Data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JLayeredPane vs JPanel
 
Similar Threads
repainting JLabels on a JPanel
How do I layer components on top of each other without blocking lower components?
How do I get layered items to show outside the parent frame?
GUI Problem - JLayeredPane with GridBagLayout
Rescalling JComponents