Olá,
Como posso alterar o texto de um botão jToggleButton quando ele for pressionado?
Ex.:
Ele inicia como “Habilitar” e após pressionado, ele se tornaria “Desabilitado”
private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if (jToggleButton1.isSelected())
try {
Runtime.getRuntime().exec("programa.exe");
System.out.println("Habilitando...");
} catch (IOException ex) {
Logger.getLogger(Delta.class.getName()).log(Level.SEVERE, null, ex);
} else {
try {
Runtime.getRuntime().exec("TASKKILL /IM programa.EXE /F");
System.out.println("Desabilitando...");
} catch (IOException ex) {
Logger.getLogger(Delta.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Como ficaria o código alterado ?
Utilizo o NetBeans 6.5
Obrigado!