aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Transparent Panel on top of Panel?" Watch "Transparent Panel on top of Panel?" New topic
Author

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
hi
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 Ajay_k_singhal@yahoo.com
Thanx
Nathan Pruett
Bartender

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...

-Nate


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

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){
super.paintComponent(g);
g.drawImage(Board,0,0,this);
//Add for loop to draw image for each square
g.drawImage(Piece[Col][Row],add math to align piece x, and y);
}

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transparent Panel on top of Panel?