< prev index next >

src/java.desktop/share/classes/javax/swing/JRootPane.java

Print this page




 905          *
 906          * @param target the Container for which this layout manager
 907          * is being used
 908          * @return a Dimension object containing the layout's maximum size
 909          */
 910         public Dimension maximumLayoutSize(Container target) {
 911             Dimension rd, mbd;
 912             Insets i = getInsets();
 913             if(menuBar != null && menuBar.isVisible()) {
 914                 mbd = menuBar.getMaximumSize();
 915             } else {
 916                 mbd = new Dimension(0, 0);
 917             }
 918             if(contentPane != null) {
 919                 rd = contentPane.getMaximumSize();
 920             } else {
 921                 // This is silly, but should stop an overflow error
 922                 rd = new Dimension(Integer.MAX_VALUE,
 923                         Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1);
 924             }
 925             return new Dimension(Math.min(rd.width, mbd.width) + i.left + i.right,
 926                                          rd.height + mbd.height + i.top + i.bottom);
 927         }
 928 
 929         /**
 930          * Instructs the layout manager to perform the layout for the specified
 931          * container.
 932          *
 933          * @param parent the Container for which this layout manager
 934          * is being used
 935          */
 936         public void layoutContainer(Container parent) {
 937             Rectangle b = parent.getBounds();
 938             Insets i = getInsets();
 939             int contentY = 0;
 940             int w = b.width - i.right - i.left;
 941             int h = b.height - i.top - i.bottom;
 942 
 943             if(layeredPane != null) {
 944                 layeredPane.setBounds(i.left, i.top, w, h);
 945             }




 905          *
 906          * @param target the Container for which this layout manager
 907          * is being used
 908          * @return a Dimension object containing the layout's maximum size
 909          */
 910         public Dimension maximumLayoutSize(Container target) {
 911             Dimension rd, mbd;
 912             Insets i = getInsets();
 913             if(menuBar != null && menuBar.isVisible()) {
 914                 mbd = menuBar.getMaximumSize();
 915             } else {
 916                 mbd = new Dimension(0, 0);
 917             }
 918             if(contentPane != null) {
 919                 rd = contentPane.getMaximumSize();
 920             } else {
 921                 // This is silly, but should stop an overflow error
 922                 rd = new Dimension(Integer.MAX_VALUE,
 923                         Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1);
 924             }
 925             return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right,
 926                                          rd.height + mbd.height + i.top + i.bottom);
 927         }
 928 
 929         /**
 930          * Instructs the layout manager to perform the layout for the specified
 931          * container.
 932          *
 933          * @param parent the Container for which this layout manager
 934          * is being used
 935          */
 936         public void layoutContainer(Container parent) {
 937             Rectangle b = parent.getBounds();
 938             Insets i = getInsets();
 939             int contentY = 0;
 940             int w = b.width - i.right - i.left;
 941             int h = b.height - i.top - i.bottom;
 942 
 943             if(layeredPane != null) {
 944                 layeredPane.setBounds(i.left, i.top, w, h);
 945             }


< prev index next >