/[classpath]/classpath/javax/swing/JRootPane.java
ViewVC logotype

Diff of /classpath/javax/swing/JRootPane.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.26 by abalkiss, Thu Sep 15 17:24:01 2005 UTC revision 1.27 by abalkiss, Mon Sep 19 18:17:10 2005 UTC
# Line 164  public class JRootPane extends JComponen Line 164  public class JRootPane extends JComponen
164      public void layoutContainer(Container c)      public void layoutContainer(Container c)
165      {      {
166        Dimension menuBarSize;        Dimension menuBarSize;
167        Dimension containerSize = c.getSize(null);        int containerWidth = c.getBounds().width - getInsets().left
168                               - getInsets().right;
169          int containerHeight = c.getBounds().height - getInsets().top
170                                - getInsets().bottom;
171        Dimension contentPaneSize = contentPane.getPreferredSize();        Dimension contentPaneSize = contentPane.getPreferredSize();
172    
173          // 1. the glassPane fills entire viewable region (bounds - insets).
174          // 2. the layeredPane filles entire viewable region.
175          // 3. the menuBar is positioned at the upper edge of layeredPane.
176          // 4. the contentPane fills viewable region minus menuBar, if present.
177          
178        /*        /*
179         if size of top-level window wasn't set then just set         if size of top-level window wasn't set then just set
180         contentPane and menuBar to its preferred sizes.         contentPane and menuBar to its preferred sizes.
# Line 189  public class JRootPane extends JComponen Line 197  public class JRootPane extends JComponen
197         +-------------------------------+         +-------------------------------+
198    
199        */        */
200        if (containerSize.width == 0 && containerSize.height == 0)        if (containerWidth == 0 && containerHeight == 0)
201          {          {
202            if (menuBar != null)            if (menuBar != null)
203              {              {
# Line 197  public class JRootPane extends JComponen Line 205  public class JRootPane extends JComponen
205                menuBarSize = menuBar.getPreferredSize();                menuBarSize = menuBar.getPreferredSize();
206                maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);                maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
207                menuBar.setBounds(0, 0, maxWidth, menuBarSize.height);                menuBar.setBounds(0, 0, maxWidth, menuBarSize.height);
208                glassPane.setBounds(0, menuBarSize.height, maxWidth,                glassPane.setBounds(0, 0, maxWidth, menuBarSize.height
209                                    contentPaneSize.height);                                                    + contentPaneSize.height);
210                contentPane.setBounds(0, menuBarSize.height, maxWidth,                contentPane.setBounds(0, menuBarSize.height, maxWidth,
211                                      contentPaneSize.height);                                      contentPaneSize.height);
212                layeredPane.setSize(maxWidth,                layeredPane.setBounds(0, 0, maxWidth, menuBarSize.height
213                                    menuBarSize.height + contentPaneSize.height);                                                      + contentPaneSize.height);
214              }              }
215            else            else
216              {              {
# Line 210  public class JRootPane extends JComponen Line 218  public class JRootPane extends JComponen
218                                    contentPaneSize.height);                                    contentPaneSize.height);
219                contentPane.setBounds(0, 0, contentPaneSize.width,                contentPane.setBounds(0, 0, contentPaneSize.width,
220                                      contentPaneSize.height);                                      contentPaneSize.height);
221                layeredPane.setSize(contentPaneSize.width, contentPaneSize.height);                layeredPane.setBounds(0, 0, contentPaneSize.width,
222                                        contentPaneSize.height);
223              }              }
224          }          }
225        else        else
# Line 218  public class JRootPane extends JComponen Line 227  public class JRootPane extends JComponen
227            if (menuBar != null)            if (menuBar != null)
228              {              {
229                menuBarSize = menuBar.getPreferredSize();                menuBarSize = menuBar.getPreferredSize();
230                if (menuBarSize.height > containerSize.height)                if (menuBarSize.height > containerHeight)
231                  menuBarSize.height = containerSize.height;                  menuBarSize.height = containerHeight;
232                menuBar.setBounds(0, 0, containerSize.width, menuBarSize.height);                menuBar.setBounds(0, 0, containerWidth, menuBarSize.height);
233                int remainingHeight = containerSize.height - menuBarSize.height;                glassPane.setBounds(0, 0, containerWidth, containerHeight);
234                glassPane.setBounds(0, menuBarSize.height, containerSize.width,                contentPane.setBounds(0, menuBarSize.height, containerWidth,
235                                    containerSize.height - menuBarSize.height);                                      (containerHeight - menuBarSize.height));
               contentPane.setBounds(0, menuBarSize.height,  
                                     containerSize.width,  
                                     (containerSize.height - menuBarSize.height));  
236              }              }
237            else            else
238              {              {
239                glassPane.setBounds(0, 0, containerSize.width,                glassPane.setBounds(0, 0, containerWidth, containerHeight);
240                                    containerSize.height);                contentPane.setBounds(0, 0, containerWidth, containerHeight);
               contentPane.setBounds(0, 0, containerSize.width,  
                                     containerSize.height);  
241              }              }
242              layeredPane.setBounds(0, 0, containerWidth, containerHeight);
           layeredPane.setSize(containerSize.width, containerSize.height);  
243          }          }
244      }      }
245    

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26