JLayeredPane layeredPane = this.frame.getLayeredPane();
Insets layeredPaneInsets = new Insets(0,0,0,0);
JMenuBar menuBar = this.frame.getJMenuBar();
int menuHeight = (menuBar == null) ? 0 : menuBar.getHeight(); // Compensate for only the height of the menu, the width is derived from the screen.
Component glassPane = this.frame.getGlassPane();
JRootPane rootPane = this.frame.getRootPane();
Insets RootPaneInsets = new Insets(0,0,0,0);
// Layered pane = content pane + menu bar + insets
if (layeredPane != null) {
layeredPane.getInsets(layeredPaneInsets);
// TF:20/8/07:Tests show that if we include the menu height here that our window comes out too big,
// by the height of the menu. So setting the layered pane size must cater for this.
newSize.height += menuHeight + layeredPaneInsets.top + layeredPaneInsets.bottom;
newSize.width += layeredPaneInsets.left + layeredPaneInsets.right;
if (_log.isDebugEnabled()) {
_log.debug("\tsetting layered pane size to " + newSize);
}
if (newSize.height != layeredPane.getHeight()
|| newSize.width != layeredPane.getWidth()) {
layeredPane.setSize(newSize);
layeredPane.revalidate();
layeredPane.repaint();
}
}
// size the glass pane
if (glassPane != null) {
if (_log.isDebugEnabled()) {
_log.debug("\tsetting glass pane size to " + newSize);
}
if (newSize.height != glassPane.getHeight()
|| newSize.width != glassPane.getWidth()) {
glassPane.setSize(newSize);
}
}
//size the root pane
if (rootPane != null) {
rootPane.getInsets(RootPaneInsets);
newSize.height += RootPaneInsets.top + RootPaneInsets.bottom;
newSize.width += RootPaneInsets.left + RootPaneInsets.right;
if (_log.isDebugEnabled()) {
_log.debug("\tsetting root pane size to " + newSize);
}
if (newSize.height != rootPane.getHeight()
|| newSize.width != rootPane.getWidth()) {
rootPane.setSize(newSize);
rootPane.revalidate(); //PM:4/8/07 Added to correct paint issue
rootPane.repaint();
}
}
if (_log.isDebugEnabled()) {
_log.debug("\tSetting owning container's size to ("