I have a JPanel that I am adding JLabels onto that contain an ImageIcon. There are times when I need to place a new JLabel on top of another JLabel but without removing one. The one I place on top always get's placed underneath the first JLabel. I have tried Integer.MAX_VALUE and Integer.MIN_VALUE but it isn't working. Any ideas?
Hi Greg, Even im trying to to get a soln this problem, I know its too late, but I found ur messg using the Search option, I'm using labels with images, & the new label gets added below the first one..any ideas?
I'm not really sure if this will help you but cant you use CardLayout to display different Components. Bascially if you want to display 3 different sets of Components then you will create 3 "Cards". These cards can take the same space in a Component but only one will be displayed. So if you want to have a label on top of another then create different "Cards" and display the one you want. Hope this helps.
No guys, What I want to do is display a component over a component..its like a chair over a floor, i need to display the floor as well as the chair, but with JLabels having an image,the chair goes under the floor..hope u all get the idea
My whole reasoning was for cards layed out over each other but cascading.
posted 17 years ago
In my limited experience with Java, it is not possible to display one component on top of another in the same panel/container. I believe it is possible to place the two components into two panels and switch between the panels using cardlayout. I hope this helps.
Pete<br />"Reality is an illusion <br />brought on by a lack of <br />drink, drugs and smut"