private JButton getClassNameButton() {
if (classNameButton == null) {
classNameButton = new JButton();
classNameButton.setText("运行应用程序");
classNameButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
/*if(!(run.isAlive())){
run = new Thread(new ExciseExec());
}*/
try{
run.start();
}catch(Exception e1){

}
//card.show(getAreaPanel(),"dosTextArea");
}
});
}
return classNameButton;
}
该JButton内部类中的Thread类实现时用this参数不行,如果用自身主类(new ExciseExec())参数则重新创建了一个JFram的试图,相应的Run方法
public void run() {
System.out.println("run");
if(Thread.currentThread() == compiler){
getCompilerTextArea().setText("");
String temp = getInputTextArea().getText().trim();
System.out.println("temp :"+temp);
byte[] b = temp.getBytes();
int leng = b.length;
String fileName = getFileNameTextField().getText().trim();

try {
loadFile = new File(fileName);
String name = loadFile.getAbsolutePath();
System.out.println("name"+name);
FileOutputStream fos = new FileOutputStream(loadFile);
fos.write(b,0,leng);
fos.close();
} catch (IOException e) {}
              }
却不能执行if内部的循环,请问各位大侠如何解决这个问题!