AbstractButton: parent class for JButton : AbstractButton « Swing « Java Tutorial






AbstractButton
      |
      +--JButton, JMenuItem, JToggleButton
  1. If a button is clicked multiple times within this time period, no additional action events will be triggered.
  2. By default, the value is zero.
AbstractButton: parent class for JButton
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.AbstractButton;
import javax.swing.JButton;
import javax.swing.JFrame;

public class MultiClickThreshholdDemo {

  public static void main(String[] a) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    AbstractButton bn = new JButton();
    bn.setMultiClickThreshhold(1000);
    
     bn.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        System.out.println("action");      }
     });

    frame.add(bn);

    frame.setSize(300, 200);
    frame.setVisible(true);
  }
}








14.4.AbstractButton
14.4.1.AbstractButton: parent class for JButtonAbstractButton: parent class for JButton
14.4.2.Supporting HTML textSupporting HTML text
14.4.3.Constants for AbstractButton PropertyChangeListener
14.4.4.Adding PropertyChangeListener to AbstractButtonAdding PropertyChangeListener to AbstractButton
14.4.5.AbstractButton Positioning