aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/JDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/JDialog.java')
-rw-r--r--libjava/classpath/javax/swing/JDialog.java48
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;
}
}