📄 calcthread.java
字号:
/*
* CalcThread.java
*
* Created on 13 October 2006, 14:23
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package wpc.threads;
import javax.swing.JTextArea;
/**
*
* @author craig
*/
public class CalcThread extends Thread{
wpc.data.World world;
wpc.MainFrame mainFrame;
/** Creates a new instance of CalcThread */
public CalcThread(wpc.MainFrame mainFrame) {
this.mainFrame = mainFrame;
}
public void run() {
mainFrame.debugAdd("Thread Info: Calculation Thread Started\n");
while (!mainFrame.getCreated()){
try {
Thread.sleep(1000);
//System.out.println("Checking");
} catch (InterruptedException e){
// the VM doesn't want us to sleep anymore,
// so get back to work
}
}
while (mainFrame.getStarted()) {
if(mainFrame.getRunning()){
mainFrame.getWorld().calcYear();
mainFrame.setYearPlus();
mainFrame.updateSidebar();
mainFrame.updateGraphics();
}
try {
Thread.sleep(mainFrame.getDelay());
//System.out.println("Checking");
} catch (InterruptedException e){
// the VM doesn't want us to sleep anymore,
// so get back to work
}
}
mainFrame.resetCalc();
mainFrame.debugAdd("Thread Killed\n");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -