- 360 名前:346 mailto:sage [2008/07/19(土) 09:56:51 ]
- 分かりづらい説明、失礼しました。
始めからソースを乗せれば良かったのですが、何分恥ずかしかったので…。 public class SampleP4 extends Applet implements Runnable{ int num; int x; public void init(){ Thread th; th = new Thread(this); th.start(); } public void run(){ try{ for(int i=0; i<10; i++){ num = i; x = i * 10; repaint(); Thread.sleep(1000); } } catch(InterruptedException e){} } public void paint(Graphics g){ String str = num + "です。"; try { for(int i=0; i<10; i++){ g.drawString(str, (10 + x), 10+i*10); Thread.sleep(1000); } } catch (InterruptedException e) {} } } repaint()では別スレッドが呼び出されているとは思うのですが…
|

|