Posted by ajmmm
on November 27, 2009 at 4:12 AM PST
I'm still trying to have a cross platform application using per pixel translucency.
I'm creating a JFrame with a proper GraphicsConfiguration, calling AWTUtilities.setWindowOpaque(w,false),adding a JPanel and setting the panel's color to (0,0,0,1).
Then, I overload the paint() method in the panel to paint what is needed.
Currently, I'm founding this:
-In Windows, with jre6u18b03, I must call super.paintComponent() instead of super.paint() inside the overidden paint() method; otherwise, background is not repainted (in each repaint it gets more opaque).
-In Windows, with other than jre6u18b03, I must call panel.setDoubleBuffered(false) in same configuration to work (OK, this is expected).
-In Windows, if I call panel.setOpaque(false), the panel never gets mouse events, unless mouse cursor is over an opaque pixel.
-In Linux, I must call panel.setOpaque(false); otherwise, I get the same "pregressevly more opaque" background. However, (as expected), inside the overridden paint() method I must call super.paint(g); Performance is much better tha in windows.
-In Mac, I cannot use AWTUtilities, but changing frame's background color to something with "alpha", it gets translucent. But, ... repainting is always wrong. The result from previous painting operation is not cleared before perform next paint. As a result, a mouse pointer moving becomes a mouse track.
Enable or disabel opengl, all other tricks didn't help, until now.
The guidelines that state "remove decoration, set frame translucent, set double buffering false" seem to be variable,... or I'm completely confused.
Can someone please help me again?