我有一个带有打开和后退按钮的表单。我通过打开按钮打开我的批处理文件,而批处理文件正在执行,其他按钮被禁用。我想启用这些按钮。请帮我。
运行批处理文件代码:
private void openActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
// back.setEnabled(true);
String filename = "C:\\JMeter Project\\jakarta-jmeter-2.5.1\\bin\\jmeter.bat";
String command = filename;
Runtime runtime = Runtime.getRuntime();
try {
Process process = runtime.exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = reader.readLine();
while (line != null) {
System.out.println(line);
line = reader.readLine();
System.out.println(line);
}
back.setEnabled(true);
JOptionPane.showMessageDialog(null, "Batch file executed successfully.....!!!!");
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Batch file execution failed.");
}
// Form f=new Form();
// back.action(f.setVisible(true),null);
}
返回按钮代码:
private void backActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
close();
sms_sound s = new sms_sound();
//s.setVisible(true);
Form f = new Form();
f.setVisible(true);
// back.setEnabled(true);
}