diff options
Diffstat (limited to 'libjava/classpath/javax/swing/JRootPane.java')
-rw-r--r-- | libjava/classpath/javax/swing/JRootPane.java | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/libjava/classpath/javax/swing/JRootPane.java b/libjava/classpath/javax/swing/JRootPane.java index dec43956ca3..a2cd9c7a000 100644 --- a/libjava/classpath/javax/swing/JRootPane.java +++ b/libjava/classpath/javax/swing/JRootPane.java @@ -50,6 +50,7 @@ import java.awt.Rectangle; import java.io.Serializable; import javax.accessibility.Accessible; +import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; import javax.swing.plaf.RootPaneUI; @@ -624,12 +625,15 @@ public class JRootPane extends JComponent implements Accessible public void setDefaultButton(JButton newButton) { - if (defaultButton == newButton) - return; - - JButton oldButton = defaultButton; - defaultButton = newButton; - firePropertyChange("defaultButton", oldButton, newButton); + // We only change the default button if the new button is defaultCapable + // or null and the old and new button are different objects. + if (defaultButton != newButton + && (newButton == null || newButton.isDefaultCapable())) + { + JButton oldButton = defaultButton; + defaultButton = newButton; + firePropertyChange("defaultButton", oldButton, newButton); + } } /** @@ -674,4 +678,17 @@ public class JRootPane extends JComponent implements Accessible { return ! glassPane.isVisible(); } + + /** + * Returns the accessible context for this JRootPane. This will be + * an instance of {@link AccessibleJRootPane}. + * + * @return the accessible context for this JRootPane + */ + public AccessibleContext getAccessibleContext() + { + if (accessibleContext == null) + accessibleContext = new AccessibleJRootPane(); + return accessibleContext; + } } |