How do I programmatically send an ActionEvent (eg button pressed/ACTION_PERFORMED) to a JButton?
I know of:
button.doClick(
Only if you inherit and expose the fireActionPerformed method, which is protected:
class MockButton extends JButton {
// bunch of constructors here
@Override
public void fireActionPerformed( ActionEvent e ) {
super.fireActionPerformed( e );
}
}
Then you will be able, but of course, you have to use a reference like this:
MockButton b = ....
b.fireActionPerformed( new Action... etc. etc
Why would you like to do that? I don't know, but I would suggest you to follow Mark's advice