Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #1262
| From | markspace <-@.> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: pls hlep, can't get output |
| Date | 2011-10-17 22:03 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <j7j1aq$2vj$1@dont-email.me> (permalink) |
| References | <16b2abac-4141-4153-9f24-05770f056b97@r2g2000prh.googlegroups.com> |
On 10/17/2011 9:00 PM, kk wrote:
> This is program.But problem is that there is no output.I faded to
> catch the problem.
Here's the problem:
while( true ) {
g.drawLine( startX, startY, endX, endY );
newpoint();
//this.repaint(startX,startY,endX,endY);
try {
Thread.sleep( 1000 );
You have to exit the EDT to allow it to update. If you do a
"while(true)", you have an infinite loop and never exit. Hence, no
output because the EDT can not run.
Look into using a Swing Timer instead of using a loop like this.
<http://download.oracle.com/javase/6/docs/api/javax/swing/Timer.html>
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
pls hlep, can't get output kk <kcool.99x@gmail.com> - 2011-10-17 21:00 -0700 Re: pls hlep, can't get output markspace <-@.> - 2011-10-17 22:03 -0700 Re: pls hlep, can't get output markspace <-@.> - 2011-10-17 22:53 -0700 Re: pls hlep, can't get output Roedy Green <see_website@mindprod.com.invalid> - 2011-10-19 15:22 -0700
csiph-web