/** * Get the preferred size at which this Widget will look best. When a WidgetContainer lays out its * contents, it will attempt to make this Widget as close as possible to its preferred size. */ public Dimension getPreferredSize() { if (prefColSize == null) calculateSizes(); Dimension prefSize = new Dimension(0, 0); for (int i = 0; i < prefColSize.length; i++) prefSize.width += prefColSize[i]; for (int i = 0; i < prefRowSize.length; i++) prefSize.height += prefRowSize[i]; return prefSize; }
/** * Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays * out its contents, it will attempt never to make this Widget smaller than its minimum size. */ public Dimension getMinimumSize() { if (minColSize == null) calculateSizes(); Dimension minSize = new Dimension(0, 0); for (int i = 0; i < minColSize.length; i++) minSize.width += minColSize[i]; for (int i = 0; i < minRowSize.length; i++) minSize.height += minRowSize[i]; return minSize; }