JButton won’t show SHORT_DESCRIPTION, nor does the setEnabled work.
...
ButtonAction action = new ButtonAction();
command.addActionListener(action);
class ButtonAction extends AbstractAction{
public ButtonAction(){
putValue(Action.SHORT_DESCRIPTION, "Comnine the two value");
setEnabled(false);
}
public void actionPerformed(ActionEvent event){
}
}
You have to create the button with the
Actionor usesetAction();addActionListener()by itself is not sufficient. Here’s a complete example; see How to Use Actions for examples andActionfor more on bound properties.