/** * Returns the minimum amount of space the layout needs. * * @param parent the Container for which this layout manager * is being used * @return a Dimension object containing the layout's minimum size */ public Dimension minimumLayoutSize(Container parent) { Dimension rd, mbd; Insets i = rootPane.getInsets(); Container contentPane = rootPane.getContentPane(); JMenuBar menuBar = rootPane.getJMenuBar(); if (contentPane != null && contentPane.isVisible()) { rd = contentPane.getMinimumSize(); } else if (contentPane != null) { rd = new Dimension(0, contentPane.getPreferredSize().height); } else { rd = new Dimension(0,0); } if (menuBar != null && menuBar.isVisible()) { mbd = menuBar.getMinimumSize(); } else { mbd = new Dimension(0, 0); } return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right, rd.height + mbd.height + i.top + i.bottom); }
@Override public Dimension minimumLayoutSize(Container parent) { int contentWidth = 0; int menuWidth = 0; int height = 0; Insets insets = parent.getInsets(); height += insets.top + insets.bottom; JRootPane rootPane = (JRootPane) parent; Dimension contentSize; if (rootPane.getContentPane() != null) { contentSize = rootPane.getContentPane().getMinimumSize(); } else { contentSize = rootPane.getSize(); } contentWidth = contentSize.width; height += contentSize.height; if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) { Dimension menuSize = rootPane.getJMenuBar().getMinimumSize(); height += menuSize.height; menuWidth = menuSize.width; } return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height); }
@Override public Dimension minimumLayoutSize(Container parent) { int contentWidth = 0; int menuWidth = 0; int height = 0; Insets insets = parent.getInsets(); height += insets.top + insets.bottom; JRootPane rootPane = (JRootPane) parent; Dimension contentSize; if (rootPane.getContentPane() != null) { contentSize = rootPane.getContentPane().getMinimumSize(); } else { contentSize = rootPane.getSize(); } contentWidth = contentSize.width; height += contentSize.height; if (rootPane.getJMenuBar() != null && rootPane.getJMenuBar().isVisible()) { Dimension menuSize = rootPane.getJMenuBar().getMinimumSize(); height += menuSize.height; menuWidth = menuSize.width; } return new Dimension(Math.max(contentWidth, menuWidth) + insets.left + insets.right, height); }
mbd = root.getJMenuBar().getMinimumSize(); if (mbd != null) { mbWidth = mbd.width;
mbd = root.getJMenuBar().getMinimumSize(); if (mbd != null) { mbWidth = mbd.width;
mbd = root.getJMenuBar().getMinimumSize(); if (mbd != null) { mbWidth = mbd.width;
mbd = root.getMenuBar().getMinimumSize(); if (mbd != null)
mbd = root.getJMenuBar().getMinimumSize(); if (mbd != null) { mbWidth = mbd.width;