Re: What's the swing equivalent for Canvas?

From: Andrew Thompson (SeeMySites_at_www.invalid)
Date: 04/06/04


Date: Tue, 06 Apr 2004 16:19:49 GMT

On 6 Apr 2004 06:03:10 -0700, King W.Wang wrote:

> king_wwang@yahoo.de (King W.Wang) wrote in message news:<51d6351d.0404020149.55de80f@posting.google.com>...
>> Andrew Thompson <SeeMySites@www.invalid> wrote in message news:<elt0mt6yb97m.1bnfpzpt1zqa0$.dlg@40tude.net>...
>>> you can find an example here..
>>>
>>> <http://www.physci.org/launcher.jsp#JAnimateFrame>
...
> I've read in your program

This is exasperating, I try very hard to
ensure all materials at my site/s are
correctly attributed.

For that reason, it was quite important to
me to add @author tags straight from the
JDoc comments, so that I could include them
on the page with the link.

But nobody notices them!

> ..and found that the grid is
> painted each time when the balls are moved. Certainly
> it's easy to do so for your program, since the grid
> are painted with 2 for loops.

Yes, it is a bit hackish.
(And yes, that is a part I _did_ write).

>..But if the picture is
> more complicated, (e.g. a map, which is painted after
> complex calculation,) it would be inefficient.

I am not sure, perhaps some painting Guru
could correct me if I'm wrong..

I had considered what you mentioned, and
was thinking of approaching more complex
rendering like this..

a) declare a Graphics object as a class attribute.
Graphics complexBG;

b) each time you enter the 'drawGrid' method,
check if the attibute is null, it it is (1st time
only) draw everything you need to on the current one,
then Graphics.create on the current one..

complexBG = g.create();

c) use the reverse at the end of the method,
once the complexBG is not null, and is drawn..

g = complexBG.create();

This may, or may not, work. If it does,
it will only draw the complex bit once.

HTH

-- 
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology


Relevant Pages

  • Re: Jamming draws in limit holdem
    ... "jamming a draw". ... pot a major factor in how you play the hand. ... It's not just mindless aggression for no reason, ...
    (rec.gambling.poker)
  • Re: The wicked untruths of our church leaders
    ... to declare that anyone is a human being. ... What imho would be especially unscientific would be to draw lines without ... I appear to be better acquainted with reason than you on this. ... care whether you think I'm humble or not nor do I care for your suggestion. ...
    (uk.religion.christian)
  • Re: Drawing a string
    ... why don't you ditch the picturebox and do all the painting in the ... OnPaint method of your form, get the graphics object you are passed, draw ... > like the picture box is in front of the string I've drawn. ...
    (microsoft.public.dotnet.framework.compactframework)
  • text in gdi+
    ... I have a position BasePoson a graphics object that I would like to ... that it is draw at to be rotated/scaled. ... required transformations to, then draw my text to that. ... you can then rotate/scale these groups. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: DrawWorks XL and Publisher Plus
    ... etc. So the feature never got released. ... Heh heh... ... and gave up trying with!Draw. ... so that seemed good enough reason to get ...
    (comp.sys.acorn.apps)