public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
if (!visible) {
return;
}
// Graphics2D g2=(Graphics2D)g;
Rectangle2D b1 = new Rectangle(x, y, 50, 50);
Ellipse2D b2 = new Ellipse2D.Double(x - 25, y + 50, 100.0, 100.0);
Area a1 = new Area(b1);
Area a2 = new Area(b2);
a1.add(a2);
g2.draw(b2);
g2.draw(b1);
Rectangle2D b3 = a1.getBounds();
g2.draw(b3);
}
이렇게 콤포넌트를 만들었고
public void run() {
while (true) {
repaint();
try {
startdancing();
repaint();
Thread.sleep(100);
} catch (InterruptedException e) {
}
}
}
쓰레드를 이용해 리페인트해주려고합니다.
그런데 저렇게해서 JPanel 에 넣어줬는데 패널에 도형이 안드네요 ㅠㅠㅠ 왜그런걸까요 ㅠㅠ