444 |
} |
} |
445 |
|
|
446 |
/** |
/** |
|
* Helper class used to subscribe to FocusEvents received by the button. |
|
|
*/ |
|
|
private class ButtonFocusListener implements FocusListener |
|
|
{ |
|
|
/** |
|
|
* Possibly repaint the model in response to loss of focus. |
|
|
* |
|
|
* @param event The loss-of-focus event |
|
|
*/ |
|
|
public void focusLost(FocusEvent event) |
|
|
{ |
|
|
if (AbstractButton.this.isFocusPainted()) |
|
|
AbstractButton.this.repaint(); |
|
|
} |
|
|
|
|
|
/** |
|
|
* Possibly repaint the button in response to acquisition of focus. |
|
|
* |
|
|
* @param event The gained-focus event |
|
|
*/ |
|
|
public void focusGained(FocusEvent event) |
|
|
{ |
|
|
if (AbstractButton.this.isFocusPainted()) |
|
|
AbstractButton.this.repaint(); |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
447 |
* Creates a new AbstractButton object. |
* Creates a new AbstractButton object. |
448 |
*/ |
*/ |
449 |
public AbstractButton() |
public AbstractButton() |
524 |
borderPainted = true; |
borderPainted = true; |
525 |
contentAreaFilled = true; |
contentAreaFilled = true; |
526 |
|
|
527 |
iconTextGap = 4; |
focusPainted = true; |
528 |
|
setFocusable(true); |
529 |
|
|
530 |
setAlignmentX(LEFT_ALIGNMENT); |
setAlignmentX(LEFT_ALIGNMENT); |
531 |
setAlignmentY(CENTER_ALIGNMENT); |
setAlignmentY(CENTER_ALIGNMENT); |
532 |
|
|
|
addFocusListener(new ButtonFocusListener()); |
|
533 |
setDisplayedMnemonicIndex(-1); |
setDisplayedMnemonicIndex(-1); |
534 |
} |
} |
535 |
|
|