I’ve created a sub-class of JButton. I was able to override mouse events with the following code:
@Override
protected void processMouseEvent(MouseEvent e) {
super.processMouseEvent(e);
// My event code...
}
I was wondering what I should override to get events to happen when the object is enabled or diasbled.
My subclassing of JButton was mostly for cosmetic reasons, just so I can set exactly what the buttons look like. I want to be able to gray out the buttons when they become disabled. If you think I should be doing this a different way, please let me know.
You don’t need to override anything. Enabling or disabling the button will trigger a propertyChange event with “enabled” as the property name.