Disable JButton
when I disable the JButton, but why i can click it and perform a MouseClicked()?
how can i disable the button and it don't perform anything?
thank you
publicclass TestButtonextends javax.swing.JFrame{
/** Creates new form TestButton */
public TestButton(){
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
privatevoid initComponents(){
jButton1 =new javax.swing.JButton();
getContentPane().setLayout(null);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("jButton1");
jButton1.setEnabled(false);
jButton1.addMouseListener(new java.awt.event.MouseAdapter(){
publicvoid mouseClicked(java.awt.event.MouseEvent evt){
jButton1MouseClicked(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(0, 0, 73, 23);
pack();
}// </editor-fold>
privatevoid jButton1MouseClicked(java.awt.event.MouseEvent evt){
System.out.println("Muse Click");
}
/**
* @param args the command line arguments
*/
publicstaticvoid main(String args[]){
java.awt.EventQueue.invokeLater(new Runnable(){
publicvoid run(){
new TestButton().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
// End of variables declaration
}

