I have a button. I want it to be disable for a set time after being clicked, and then enabled again.
How do I implement it being disabled on a timer in it's action?
Image cImage3 = getToolkit().createImage("buttonpressed.png");
ImageIcon cIcon3 = new ImageIcon(cImage3);
button1.setPressedIcon(cIcon3);
Image cImage = getToolkit().createImage("buttonover.png");
ImageIcon cIcon = new ImageIcon(cImage);
button1.setRolloverIcon(cIcon);
Image cImage2 = getToolkit().createImage("button.png");
ImageIcon cIcon2 = new ImageIcon(cImage2);
button1.setIcon(cIcon2);
button1.setBorder(null);
button1.setBorder(BorderFactory.createEmptyBorder(2,2,2,2));
button1.setHorizontalAlignment(JButton.LEADING); // optional
button1.setBorderPainted(false);
button1.setContentAreaFilled(false);
button1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
}


Sign In
Create Account

Back to top









