437 |
*/ |
*/ |
438 |
protected boolean rootPaneCheckingEnabled = false; |
protected boolean rootPaneCheckingEnabled = false; |
439 |
|
|
|
/** |
|
|
* Tells us if we're in the initialization stage. |
|
|
* If so, adds go to top-level Container, otherwise they go |
|
|
* to the content pane for this container. |
|
|
*/ |
|
|
private boolean initStageDone = false; |
|
|
|
|
440 |
/** Whether the JInternalFrame is resizable. */ |
/** Whether the JInternalFrame is resizable. */ |
441 |
protected boolean resizable; |
protected boolean resizable; |
442 |
|
|
560 |
storedBounds = new Rectangle(); |
storedBounds = new Rectangle(); |
561 |
setRootPane(createRootPane()); |
setRootPane(createRootPane()); |
562 |
updateUI(); |
updateUI(); |
563 |
initStageDone = true; // Done the init stage, now adds go to content pane. |
setRootPaneCheckingEnabled(true); // Done the init stage, now adds go to content pane. |
564 |
} |
} |
565 |
|
|
566 |
/** |
/** |
580 |
// If we're in the initialization stage use super.add. Here we add the |
// If we're in the initialization stage use super.add. Here we add the |
581 |
// rootPane as well as the title bar and other stuff. |
// rootPane as well as the title bar and other stuff. |
582 |
// Otherwise pass the add onto the content pane. |
// Otherwise pass the add onto the content pane. |
583 |
if (!initStageDone) |
if (isRootPaneCheckingEnabled()) |
584 |
super.addImpl(comp,constraints, index); |
getContentPane().add(comp, constraints, index); |
585 |
else |
else |
586 |
{ |
super.addImpl(comp,constraints, index); |
|
if (isRootPaneCheckingEnabled()) |
|
|
throw new Error("Do not use add() on JInternalFrame directly. Use " |
|
|
+ "getContentPane().add() instead"); |
|
|
getContentPane().add(comp, constraints, index); |
|
|
} |
|
587 |
} |
} |
588 |
|
|
589 |
/** |
/** |
1175 |
*/ |
*/ |
1176 |
protected String paramString() |
protected String paramString() |
1177 |
{ |
{ |
1178 |
return "JInternalFrame"; |
return super.paramString(); |
1179 |
} |
} |
1180 |
|
|
1181 |
/** |
/** |
1215 |
public void reshape(int x, int y, int width, int height) |
public void reshape(int x, int y, int width, int height) |
1216 |
{ |
{ |
1217 |
super.reshape(x, y, width, height); |
super.reshape(x, y, width, height); |
1218 |
invalidate(); |
revalidate(); |
|
doLayout(); |
|
1219 |
} |
} |
1220 |
|
|
1221 |
/** |
/** |
1476 |
{ |
{ |
1477 |
// Check if we're in initialization stage. If so, call super.setLayout |
// Check if we're in initialization stage. If so, call super.setLayout |
1478 |
// otherwise, valid calls go to the content pane. |
// otherwise, valid calls go to the content pane. |
1479 |
if (initStageDone) |
if (isRootPaneCheckingEnabled()) |
1480 |
{ |
getContentPane().setLayout(manager); |
|
if (isRootPaneCheckingEnabled()) |
|
|
throw new Error("Cannot set layout. Use getContentPane().setLayout()" |
|
|
+ " instead."); |
|
|
getContentPane().setLayout(manager); |
|
|
} |
|
1481 |
else |
else |
1482 |
super.setLayout(manager); |
super.setLayout(manager); |
1483 |
} |
} |
1660 |
*/ |
*/ |
1661 |
public void setUI(InternalFrameUI ui) |
public void setUI(InternalFrameUI ui) |
1662 |
{ |
{ |
1663 |
|
// We must temporarily go into init mode so that the UI can directly |
1664 |
|
// manipulate the JInternalFrame. |
1665 |
|
boolean old = isRootPaneCheckingEnabled(); |
1666 |
|
setRootPaneCheckingEnabled(false); |
1667 |
super.setUI(ui); |
super.setUI(ui); |
1668 |
|
setRootPaneCheckingEnabled(old); |
1669 |
} |
} |
1670 |
|
|
1671 |
/** |
/** |
1691 |
*/ |
*/ |
1692 |
public void updateUI() |
public void updateUI() |
1693 |
{ |
{ |
1694 |
|
// We must go into the init stage when updating the UI, so the UI can |
1695 |
|
// set layout and components directly on the internal frame, not its |
1696 |
|
// content pane. |
1697 |
|
boolean old = isRootPaneCheckingEnabled(); |
1698 |
|
setRootPaneCheckingEnabled(false); |
1699 |
setUI((InternalFrameUI) UIManager.getUI(this)); |
setUI((InternalFrameUI) UIManager.getUI(this)); |
1700 |
|
setRootPaneCheckingEnabled(old); |
1701 |
} |
} |
1702 |
|
|
1703 |
/** |
/** |