JDK-4199367 : JButton's "default capable" usage is incorrect.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1998-12-22
  • Updated: 1999-02-19
  • Resolved: 1999-02-19
Related Reports
Duplicate :  
Description

Name: krT82822			Date: 12/22/98


A dialog will typically have a single designated default button. Since Swing changes the default button each time you change focus to a button
that is "default capable," this requires developers to alter the state of all but one button... which is laborious and error prone in a large application
with many dialogs.

This feature may have been introduced to attempt to mirror the standard behavior of a Windows application in which the currently focused button
is painted with the bold border normally used to indicate the default button.  Unlike Swing's implementation, this is not a permanent change but is
done temporarily to avoid confusing the user about which button will be activated when enter is pressed.  When focus is restored to a non-button
control the dialog's original default button is once again painted with a bold border.

The "default capable" flag should be ignored by the Windows look and feel.  Any button that can have focus should be painted with the style of the
default button only so long as it retains focus, and the actual default button should be painted as such when focus is in any other type of component.
(Review ID: 48576)
======================================================================

Comments
EVALUATION It's true that the current implementation of default button is not correct for Windoze (or Motif), because the original default button is not restored when focus moves to a non-button component. (separate bug: 4146858). The defaultCapable property was added mostly to accommodate Motif's L&F, where some (many) buttons NEVER become the default, even with focus. We intend to fix 4146858, but unfortunately it turns out to be a pretty tough fix without making an api changes (we need more info from the focus manager). In reality, this is really a duplicate of 4146858, but is suggesting an alternative way of fixing it (changing the original meaning of isDefaultCapable), which is something which needs to be carefully considered for compatibility reasons. amy.fowler@Eng 1999-02-19
19-02-1999