• 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

Transparent Panel on top of Panel?

 
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
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
If you call setOpaque( false ) on the upper panel you will be able to see the panel under it...

-Nate
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
}

}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic