try {
convertbutton.setText("STOP");
OpenSecreeningBase.setEnabled(false);
SaveScreeningBase.setEnabled(false);
FileWriter writer = new FileWriter(screeningbase);
for (File moleculeFile : screeningBase.listFiles()) {
BitSet fingerprint = convertToFingerprint(moleculeFile); //call function
writer.append(moleculeFile.getName());
Screening_Ready.setText("Processing : " + moleculeFile.getName() + " ...");
writer.append(" ");
{
for (int i = 0; i < fingerprint.size(); i++) {
if (fingerprint.get(i)) {
writer.append("1");
writer.flush();
} else {
writer.append("0");
writer.flush();
}
}
writer.append("\n");
}
}
writer.close();
convertbutton.setText("CONVERT");[/b]]
}
} catch (Exception e) {
e.printStackTrace();
}
}
})).start();
I had designed a program. This program enable to convert thing. However the main point is when I click the convert button the word "CONVERT" will become "STOP" and become back to "CONVERT" when the program stop. But how can I stop the program when I click the button again ?
This post has been edited by xxxjayxxx: 12 May 2011 - 07:12 AM

New Topic/Question
Reply




MultiQuote







|