This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Transparent Panel on top of Panel? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Transparent Panel on top of Panel?" Watch "Transparent Panel on top of Panel?" New topic

Transparent Panel on top of Panel?

Sean Casey
Ranch Hand

Joined: Dec 16, 2000
Posts: 625
I'm creating a chess board, and I want to be able to display the chess pieces (.gif's) on the squares. I'm extending a JPanel and drawing all the squares. Is there a way to create a transparent panel on top of that panel so I'll be able to use the chessboard as the background and align the pieces in the correct locations? Any suggestions would help thanks.
Ajay Singhal
Ranch Hand

Joined: Jan 10, 2001
Posts: 37
i have the same problem of showing transparent panel on top of the panel.Actually i want to perform some drawing operations on top of the html pane.
if you come across any solution then kindly give me the solution.
you can mail me at
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

If you call setOpaque( false ) on the upper panel you will be able to see the panel under it...


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Terry Stehle

Joined: Mar 24, 2001
Posts: 24
Im currently working on a chess program. Anyways I just created a custom panel and overriden the painComponent method. Something like this
public class BoardPanel extends JPanel{
public void paintComponent(Graphics g){
//Add for loop to draw image for each square
g.drawImage(Piece[Col][Row],add math to align piece x, and y);

wood burning stoves
subject: Transparent Panel on top of Panel?