0
게임 메서드에서 paint 메서드를 어떻게 호출 할 수 있습니까?다른 메서드에서 Graphics2D 메서드를 호출하는 방법은 무엇입니까?
내가 명령을 호출하면 "new paint();" 그것은
// Main
public Game() {
super();
setTitle("Breakout");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(500, 500);
setLocationRelativeTo(null);
setIgnoreRepaint(true);
setResizable(false);
setVisible(true);
}
// Grafica
class paint extends JPanel {
public paint(Graphics2D g) {
super.paint(g);
g.setColor(Color.black);
}
}
당신은 그렇게 할 수 없습니다. 대신 페인트 할 때마다 전체 게임을 다시 그려야합니다. – SLaks