Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

image transperancy

 
Sammer Meer
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to draw an image on a panel, and it's circular, so i want the white area around the image (the circle) to be transparent.. how can i do that?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to provide more information about what you are doing and exactly what you are trying to accomplish... Are you using AWT or Swing? Are you trying to make the image background transparent in relation to other components inside your application, or are you trying to make the entire application transparent all the way to the desktop?
 
Sammer Meer
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using swing (JFrame) and im drawing some images on a JPanel, and i want their white background to be transperent so i can make some intersections between them in a way they don't cover of eah other..
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're drawing on the JPanel by overriding it's paintComponent() method, this shouldn't be an issue... you can set whether or not components paint their backgrounds by calling setOpaque( false ) on their reference, however, JPanels do not paint their background by default, so there's something else going on here... did you override paint() instead? What about your image? What format is it? Anything special about it?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic