430 |
/** Whether the JInternalFrame can be maximized. */ |
/** Whether the JInternalFrame can be maximized. */ |
431 |
protected boolean maximizable; |
protected boolean maximizable; |
432 |
|
|
433 |
/** Whether the JInternalFrame has rootPaneChecking enabled. */ |
/** |
434 |
protected boolean rootPaneCheckingEnabled = true; |
* Whether the JInternalFrame has rootPaneChecking enabled. |
435 |
|
* |
436 |
|
* @specnote Should be false to comply with J2SE 5.0 |
437 |
|
*/ |
438 |
|
protected boolean rootPaneCheckingEnabled = false; |
439 |
|
|
440 |
|
/** |
441 |
|
* Tells us if we're in the initialization stage. |
442 |
|
* If so, adds go to top-level Container, otherwise they go |
443 |
|
* to the content pane for this container. |
444 |
|
*/ |
445 |
|
private boolean initStageDone = false; |
446 |
|
|
447 |
/** Whether the JInternalFrame is resizable. */ |
/** Whether the JInternalFrame is resizable. */ |
448 |
protected boolean resizable; |
protected boolean resizable; |
565 |
this.maximizable = maximizable; |
this.maximizable = maximizable; |
566 |
this.iconable = iconifiable; |
this.iconable = iconifiable; |
567 |
storedBounds = new Rectangle(); |
storedBounds = new Rectangle(); |
|
|
|
|
setRootPaneCheckingEnabled(false); |
|
568 |
setRootPane(createRootPane()); |
setRootPane(createRootPane()); |
|
|
|
569 |
updateUI(); |
updateUI(); |
570 |
setRootPaneCheckingEnabled(true); |
initStageDone = true; // Done the init stage, now adds go to content pane. |
571 |
} |
} |
572 |
|
|
573 |
/** |
/** |
584 |
*/ |
*/ |
585 |
protected void addImpl(Component comp, Object constraints, int index) |
protected void addImpl(Component comp, Object constraints, int index) |
586 |
{ |
{ |
587 |
if (isRootPaneCheckingEnabled()) |
// If we're adding the rootPane (initialization stages) use super.add. |
588 |
throw new Error("Do not use add() on JInternalPane directly. Use getContentPane().add() instead"); |
// otherwise pass the add onto the content pane. |
589 |
|
if (comp==rootPane) |
590 |
super.addImpl(comp, constraints, index); |
super.addImpl(comp,constraints, index); |
591 |
|
else |
592 |
|
{ |
593 |
|
if (isRootPaneCheckingEnabled()) |
594 |
|
throw new Error("Do not use add() on JInternalFrame directly. Use " |
595 |
|
+ "getContentPane().add() instead"); |
596 |
|
getContentPane().add(comp, constraints, index); |
597 |
|
} |
598 |
} |
} |
599 |
|
|
600 |
/** |
/** |
1196 |
*/ |
*/ |
1197 |
public void remove(Component comp) |
public void remove(Component comp) |
1198 |
{ |
{ |
1199 |
super.remove(comp); |
// If we're removing the root pane, use super.remove. Otherwise |
1200 |
|
// pass it on to the content pane instead. |
1201 |
|
if (comp==rootPane) |
1202 |
|
super.remove(comp); |
1203 |
|
else |
1204 |
|
getContentPane().remove(comp); |
1205 |
} |
} |
1206 |
|
|
1207 |
/** |
/** |
1486 |
*/ |
*/ |
1487 |
public void setLayout(LayoutManager manager) |
public void setLayout(LayoutManager manager) |
1488 |
{ |
{ |
1489 |
if (isRootPaneCheckingEnabled()) |
// Check if we're in initialization stage. If so, call super.setLayout |
1490 |
throw new Error("Cannot set layout. Use getContentPane().setLayout() instead."); |
// otherwise, valid calls go to the content pane. |
1491 |
super.setLayout(manager); |
if (initStageDone) |
1492 |
|
{ |
1493 |
|
if (isRootPaneCheckingEnabled()) |
1494 |
|
throw new Error("Cannot set layout. Use getContentPane().setLayout()" |
1495 |
|
+ " instead."); |
1496 |
|
getContentPane().setLayout(manager); |
1497 |
|
} |
1498 |
|
else |
1499 |
|
super.setLayout(manager); |
1500 |
} |
} |
1501 |
|
|
1502 |
/** |
/** |