Google

Wednesday, March 12, 2008

Netbeans 6 Beeper

The code below beeps and also updates the statusPanel:

import javax.swing.Timer;

private final Timer myTimer;
int i = 0;

myTimer = new Timer(1000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText(Integer.toString(i++));
Toolkit.getDefaultToolkit().beep();
}
});