Example usage for javax.swing AbstractButton doClick

List of usage examples for javax.swing AbstractButton doClick

Introduction

In this page you can find the example usage for javax.swing AbstractButton doClick.

Prototype

public void doClick(int pressTime) 

Source Link

Document

Programmatically perform a "click".

Usage

From source file:Main.java

public static void main(String[] args) {
    AbstractButton jb = new JButton("Press Me");
    jb.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            System.out.println(((JComponent) arg0.getSource()).getFont());
        }/* ww w .j  a v a  2  s  .  com*/
    });
    jb.doClick(1000);
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(jb);
    f.pack();
    f.setVisible(true);
}