Web Development

General discussion


who can access fireActionPerformed()

By amit1508 ·
fireActionPerformed(ActionEvent ae) is a prptected method in the class javax.swing.AbstractButton.
JButton is a class extending AbstractButton.
Why can't we call "fireActionPerformed" on an instance of JButton ?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

who can access fireActionPerformed()

by leif In reply to who can access fireAction ...

Protected methods can be called by a subclass of the class containing the method. Protected methods are not made public by a subclass.

In your example above, AbstractButton contains a protected method fireActionPerformed(), and JButton extends AbstractButton. Any method in JButton may call fireActionPerformed(). Any method in a class that extends JButton may call fireActionPerformed(). However, an arbitrary class may not call fireActionPerformed() on an instance of JButton or AbstractButton: the method is still protected.

Related Discussions

Related Forums