GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes image transperancy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "image transperancy" Watch "image transperancy" New topic
Author

image transperancy

Sammer Meer
Greenhorn

Joined: Mar 24, 2004
Posts: 19
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?


Ai no corrida..That's where I am<br />You send me there<br />Your dream is my command...
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

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?


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

Joined: Mar 24, 2004
Posts: 19
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

Joined: Oct 18, 2000
Posts: 4121

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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: image transperancy