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


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

Re: Drawing problem

From "Michael Rauscher" <michael.rauscher@THRWHITE.remove-dii-this>
Subject Re: Drawing problem
Message-ID <esf7v1$22u$1@registered.motzarella.org> (permalink)
Newsgroups comp.lang.java.gui
References <Q5EGh.48254$TF4.35130@newsfe16.lga>
Date 2011-04-27 15:31 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
Knute Johnson wrote:
> Michael Rauscher wrote:
>> private void calculateAndPaint() {
>>     for ( int x = 0; x < 200; ++x ) {
>>         final int i = x;
>>         SwingUtilities.invokeLater( new Runnable() {
>>             public void run() {
>>                 Graphics g = img.createGraphics();
>>                 g.drawLine( i, i, i-1, i-1 );
>>                 g.dispose();
>>                 repaint();
>>             }
>>         });
>>         try { Thread.sleep(10); } catch ( InterruptedException e ) {}
>>     }
>> }
>>
> 
> There is no requirement that repaint() or graphics calls be made on the 
> EDT.

With respect to repaint: you're right, of course.

Do you mean that it's safe to manipulate an image in a non-EDT thread 
while the EDT might draw it?

I was unsure about this, perhaps you can provide some links with 
detailed informations on this subject.

> I wouldn't use paint() as the name of the method because you might 
> interfere with normal painting.

ACK. Call it draw() then.

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