Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you bring a Component to front?

Status
Not open for further replies.

musik

Programmer
Nov 20, 2001
33
US
To gain some flexibility in Java and Swing, I've been playing around with creating a "PlayingCard" component and implementing some simple card games. PlayingCard extends JPanel and simply uses two JLabels to display a suit icon and a number. PlayingCard also catches mouseDragged, etc. so that you can move the PlayingCard object around inside of its parent app/applet. Works great.

But - the cards stay in the "Z Order" in which they were added. That is, the first card add()'ed will always appear on top of all others, the last card will always appear under all others. How can I "bring to top" a particular Component? Java probably uses different terminology for this than I'm used to, and I just can't find it.

Thanks!
 
Nevermind! I got it! All I had to do was use a JLayeredPane as my top level container.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top