코드에서 나는 init()
메서드에서 repaint()
메서드를 호출하지만 예상 한대로 출력되지 않습니다. repaint()
메서드를 10 번 호출했지만 paint()
을 한 번만 호출했습니다 (O/P 스크린 샷 참조). 실수가 있습니다. 도와주세요. 감사자바 애플릿 페인트 방법 문제
코드
import java.awt.*;
import java.applet.Applet;
/*
<applet code="test" height=300 width=300>
</applet>
*/
public class test extends Applet
{
int x,y;
public void init()
{
x=5;
y=10;
for(int i=1;i<10;i++)
{
System.out.println("From init "+i);
x+=(i*2);
y+=(i*3);
repaint();
}
}
public void paint(Graphics g)
{
System.out.println("Paint");
g.drawLine(50,50,x,y);
}
}
안내해 주셔서 감사합니다. – mcacorner
@ReferenceNotFound : 환영합니다. 행운을 빈다. –