From e4be4ef440e9d6be333b2353cdb163a80ad1fe5a Mon Sep 17 00:00:00 2001 From: p8nb9htuw <2235931979@qq.com> Date: Mon, 31 Mar 2025 21:17:41 +0800 Subject: [PATCH] ADD file via upload --- src/UpdateThread.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/UpdateThread.java diff --git a/src/UpdateThread.java b/src/UpdateThread.java new file mode 100644 index 0000000..4d2dacd --- /dev/null +++ b/src/UpdateThread.java @@ -0,0 +1,22 @@ +package cn.edu.caztc.sokobangame; +import javax.swing.JPanel; + +public class UpdateThread extends Thread{ + JPanel panel; + public UpdateThread(JPanel panel) { + this.panel = panel; + } + + @Override + public void run() { + while(true){ + panel.repaint(); + try { + Thread.sleep(10); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + +} \ No newline at end of file