java_swing绘制图形

在java的jpanel绘制图形

使用paint方法,在里面使用super.paint清除之前的残留
在while里使用repaint进行循环绘画

public void display() {
		this.repaint();
	}
	public void paint(Graphics g) {
		super.paint(g);
		dao.drawBackground(g);
		dao.drawState(g, hero);
	}
while(true) {
			start.display();
			try
			{
				Thread.sleep(300);
posted @ 2023-02-02 08:49  兔子春  阅读(59)  评论(0编辑  收藏  举报