questo è il codice :
codice:
import javax.swing.JFrame;
public class Test extends JFrame {
private javax.swing.JPanel jContentPane = null;
private javax.swing.JCheckBox jCheckBox = null;
private javax.swing.JLabel jLabel = null;
public static void main(String[] args) {
}
/**
* This is the default constructor
*/
public Test() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
this.setContentPane(getJContentPane());
this.setTitle("Prova classe visuale");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJCheckBox(), null);
jContentPane.add(getJLabel(), null);
}
return jContentPane;
}
/**
* This method initializes jCheckBox
*
* @return javax.swing.JCheckBox
*/
private javax.swing.JCheckBox getJCheckBox() {
if(jCheckBox == null) {
jCheckBox = new javax.swing.JCheckBox();
jCheckBox.setBounds(37, 61, 65, 35);
jCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return jCheckBox;
}
/**
* This method initializes jLabel
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel() {
if(jLabel == null) {
jLabel = new javax.swing.JLabel();
jLabel.setBounds(132, 61, 66, 31);
jLabel.setText("JLabel");
}
return jLabel;
}
}
nella console dovrebbe venirmi scritta la stringa actionPerformed() ad una azione sul check, invece non succede nulla