This commit is contained in:
2025-10-09 16:08:40 +08:00
parent 2eb79b6c3d
commit 6845711ec5

View File

@@ -0,0 +1,33 @@
package com.github.drinkjava2.frog.env;
import java.io.File;
import javax.swing.JFrame;
/**
* Application will build env, frogs and let them run
*/
public class Application {
public static final String CLASSPATH;
static {
String classpath = new File("").getAbsolutePath();
int i = classpath.lastIndexOf("\\frog\\");
if (i > 0)
CLASSPATH = classpath.substring(0, i) + "\\frog\\";// windows
else
CLASSPATH = classpath + "/"; // UNIX
}
public static JFrame mainFrame = new JFrame();
public static void main(String[] args) throws InterruptedException {
mainFrame.setLayout(null);
mainFrame.setSize(520, 550); // 窗口大小
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 关闭时退出程序
Env env = new Env();
mainFrame.add(env);
mainFrame.setVisible(true);
env.run();
}
}