• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting the Z order of a JComponent

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to set the z order value for a JComponent? I have a custom layout manager and some of my components overlap the problem is that the components are being drawn on top of each other in the wrong order. Thanks
Kory
[ March 12, 2002: Message edited by: Kory Spansel ]
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the content pane is contained in a JLayeredPane you can add the JComponent component to layer 10 by calling,

on your JFrame. The JavaDocs say that you should do this before actually adding the component to the content pane.

You can also do this with :


But since you are using a custom layout manager the first option may meet your needs better.

-Nate
 
Kory Spansel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply but I don't think thats exactly what I'm looking for. Basically what I have is a class derived from a JComponent called StandardCard and I also have a class called CardTable derived from JPanel in which I add my StandardCards to. So I wanted to write a layout manager for the CardTable class to use. And then I will place the card table class, along with some other stuff onto a JFrame. So basically I don't have a JLayeredPane component. I have no problems setting the bounds of each component within the layout manager it's just that it draws the first component on top and the successive components underneath the previous one. It looks like your holding your poker hand upside down
Kory
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, sorry... But from what you said it sounds like the solution to your problem is easy... Just draw the cards in reverse order and they will lie on top of each other correctly!

-Nate
 
reply
    Bookmark Topic Watch Topic
  • New Topic