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


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

Re: Drawing problem

From "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this>
Subject Re: Drawing problem
Message-ID <esi2np$9gn$1@registered.motzarella.org> (permalink)
Newsgroups comp.lang.java.gui
References <8dYGh.272017$IL1.11129@newsfe13.lga>
Date 2011-04-27 15:31 +0000
Organization TDS.net

Show all headers | 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