Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1128

Re: Drawing problem

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this>
Subject Re: Drawing problem
Message-ID <esi2np$9gn$1@registered.motzarella.org> (permalink)
X-Comment-To comp.lang.java.gui
Newsgroups comp.lang.java.gui
In-Reply-To <8dYGh.272017$IL1.11129@newsfe13.lga>
References <8dYGh.272017$IL1.11129@newsfe13.lga>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 36
Date Wed, 27 Apr 2011 15:31:31 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303918291 96.60.20.240 (Wed, 27 Apr 2011 10:31:31 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:31:31 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1128

Show key headers only | View raw


  To: comp.lang.java.gui
Knute Johnson wrote:
>> So: Are there any guarantees that the EDT paint operation draws a 
>> BufferedImage that is in a state as it was before any Graphics 
>> (created via the BufferedImage) method was started that has not yet 
>> finished?
> 
> If you don't call repaint() until you are done drawing on it I doubt it. 

The underlying system might cause a repaint, too.

>  If you queued a repaint() from another thread while you were in the 
> process of doing a draw I don't think you could guarantee where in the 
> draw you would be.  If multiple threads kept multiple copies of the same 
> BufferedImage object then I think you could have a situation where you 
> draw on your copy and the other thread doesn't see it yet.  I'm not 
> really clear on when that can happen but synchronizing the code will 
> certainly prevent that.  In reality I don't think it will ever be a 
> problem.

I used the EDT to serialize subsequent calls to Graphics-methods to 
prevent synchronizing. This way it's guaranteed that there's no drawXXX 
method running while paintComponent draws the image.

But you're right. I can't imagine a situation in which it would be a 
real problem if the Graphics-method was called from a non EDT-thread.

Thanks for clarifying this topic.

Bye
Michael

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Drawing problem "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
      Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
        Re: Drawing problem "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
          Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
            Re: Drawing problem "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
              Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
                Re: Drawing problem "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
                Re: Drawing problem "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
        Re: Drawing problem "Robert Sturzenegger" <robert.sturzenegger@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000

csiph-web