diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-15 23:20:01 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-15 23:20:01 +0000 |
commit | 8f523f3a1047919d3563daf1ef47ba87336ebe89 (patch) | |
tree | a5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/javax/swing/JDialog.java | |
parent | 02e549bfaaec38f68307e7f34e46ea57ea1809af (diff) | |
download | gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.gz |
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
Diffstat (limited to 'libjava/classpath/javax/swing/JDialog.java')
-rw-r--r-- | libjava/classpath/javax/swing/JDialog.java | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/libjava/classpath/javax/swing/JDialog.java b/libjava/classpath/javax/swing/JDialog.java index 0f528ab1b45..b3f7c011f68 100644 --- a/libjava/classpath/javax/swing/JDialog.java +++ b/libjava/classpath/javax/swing/JDialog.java @@ -66,6 +66,21 @@ import javax.accessibility.AccessibleContext; public class JDialog extends Dialog implements Accessible, WindowConstants, RootPaneContainer { + /** + * Provides accessibility support for <code>JDialog</code>s. + */ + protected class AccessibleJDialog extends Dialog.AccessibleAWTDialog + { + /** + * Creates a new instance of <code>AccessibleJDialog</code>. + */ + public AccessibleJDialog() + { + super(); + // Nothing to do here. + } + } + private static final long serialVersionUID = -864070866424508218L; /** DOCUMENT ME! */ @@ -87,13 +102,6 @@ public class JDialog extends Dialog implements Accessible, WindowConstants, /** Whether JDialogs are decorated by the Look and Feel. */ private static boolean decorated; - /** - * Whether we're in the init stage or not. - * If so, adds and layouts are for top-level, otherwise they're for the - * content pane - */ - private boolean initStageDone = false; - /* Creates a new non-modal JDialog with no title * using a shared Frame as the owner. */ @@ -244,7 +252,7 @@ public class JDialog extends Dialog implements Accessible, WindowConstants, invalidate(); // Now that initStageDone is true, adds and layouts apply to contentPane, // not top-level. - initStageDone = true; + setRootPaneCheckingEnabled(true); } /** @@ -315,13 +323,8 @@ public class JDialog extends Dialog implements Accessible, WindowConstants, { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane. - if (initStageDone) - { - if (isRootPaneCheckingEnabled()) - throw new Error("Cannot set top-level layout. Use" - + " getConentPane().setLayout instead."); - getContentPane().setLayout(manager); - } + if (isRootPaneCheckingEnabled()) + getContentPane().setLayout(manager); else super.setLayout(manager); } @@ -445,15 +448,10 @@ public class JDialog extends Dialog implements Accessible, WindowConstants, { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. - if (!initStageDone) - super.addImpl(comp, constraints, index); + if (isRootPaneCheckingEnabled()) + getContentPane().add(comp, constraints, index); else - { - if (isRootPaneCheckingEnabled()) - throw new Error("Do not add directly to JDialog." - + " Use getContentPane().add instead."); - getContentPane().add(comp, constraints, index); - } + super.addImpl(comp, constraints, index); } /** @@ -588,6 +586,8 @@ public class JDialog extends Dialog implements Accessible, WindowConstants, */ public AccessibleContext getAccessibleContext() { - return null; + if (accessibleContext == null) + accessibleContext = new AccessibleJDialog(); + return accessibleContext; } } |