classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: JComponent painting reworked


From: Roman Kennke
Subject: Re: [cp-patches] FYI: JComponent painting reworked
Date: Mon, 26 Sep 2005 11:46:12 +0200

Am Sonntag, den 25.09.2005, 19:30 +0200 schrieb Mark Wielaard:
> Hi Roman,
> 
> On Thu, 2005-09-22 at 16:13 +0200, Roman Kennke wrote:
> > +  /**
> > +   * Performs normal painting without double buffering.
> > +   *
> > +   * @param r the area to be repainted
> > +   */
> > +  void paintSimple(Rectangle r)
> > +  {
> > +    Graphics g = getGraphics();
> > +    Graphics g2 = getComponentGraphics(g);
> > +    paint(g2);
> > +    g2.dispose();
> > +    g2.dispose();
> >    }
> 
> You are disposing g2 twice, but not g.

This is already fixed in one of the followup patches.

> Is there actually a reason to explicitly dispose() of an Graphics
> object? Why don't we just let Graphics.finalize() handle it?

Yeah. 1. I would consider it good style to dispose a Graphics in the
same method where you aquire a Graphics object (don't dispose Graphics
that you get as parameter). 2. The specs seem to implicate that finalize
is not very reliable.

/Roman

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]