102 |
/** Whether JDialogs are decorated by the Look and Feel. */ |
/** Whether JDialogs are decorated by the Look and Feel. */ |
103 |
private static boolean decorated; |
private static boolean decorated; |
104 |
|
|
|
/** |
|
|
* 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; |
|
|
|
|
105 |
/* Creates a new non-modal JDialog with no title |
/* Creates a new non-modal JDialog with no title |
106 |
* using a shared Frame as the owner. |
* using a shared Frame as the owner. |
107 |
*/ |
*/ |
252 |
invalidate(); |
invalidate(); |
253 |
// Now that initStageDone is true, adds and layouts apply to contentPane, |
// Now that initStageDone is true, adds and layouts apply to contentPane, |
254 |
// not top-level. |
// not top-level. |
255 |
initStageDone = true; |
setRootPaneCheckingEnabled(true); |
256 |
} |
} |
257 |
|
|
258 |
/** |
/** |
323 |
{ |
{ |
324 |
// Check if we're in initialization stage. If so, call super.setLayout |
// Check if we're in initialization stage. If so, call super.setLayout |
325 |
// otherwise, valid calls go to the content pane. |
// otherwise, valid calls go to the content pane. |
326 |
if (initStageDone) |
if (isRootPaneCheckingEnabled()) |
327 |
{ |
getContentPane().setLayout(manager); |
|
if (isRootPaneCheckingEnabled()) |
|
|
throw new Error("Cannot set top-level layout. Use" |
|
|
+ " getConentPane().setLayout instead."); |
|
|
getContentPane().setLayout(manager); |
|
|
} |
|
328 |
else |
else |
329 |
super.setLayout(manager); |
super.setLayout(manager); |
330 |
} |
} |
448 |
{ |
{ |
449 |
// If we're adding in the initialization stage use super.add. |
// If we're adding in the initialization stage use super.add. |
450 |
// Otherwise pass the add onto the content pane. |
// Otherwise pass the add onto the content pane. |
451 |
if (!initStageDone) |
if (isRootPaneCheckingEnabled()) |
452 |
super.addImpl(comp, constraints, index); |
getContentPane().add(comp, constraints, index); |
453 |
else |
else |
454 |
{ |
super.addImpl(comp, constraints, index); |
|
if (isRootPaneCheckingEnabled()) |
|
|
throw new Error("Do not add directly to JDialog." |
|
|
+ " Use getContentPane().add instead."); |
|
|
getContentPane().add(comp, constraints, index); |
|
|
} |
|
455 |
} |
} |
456 |
|
|
457 |
/** |
/** |