int prefWidth = 0; if (c != null) { Insets i = c.getInsets(); d.width += i.left + i.right; d.height += i.top + i.bottom;
int prefWidth = 0; if (c != null) { Insets i = c.getInsets(); d.width += i.left + i.right; d.height += i.top + i.bottom;
int prefWidth = 0; if (c != null) { Insets i = c.getInsets(); d.width += i.left + i.right; d.height += i.top + i.bottom;
Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); Insets insets = c == null ? new Insets(0,0,0,0) : c.getInsets(); int width = preferredWidths[i] - (insets.left + insets.right); int x = nextX + insets.left;
Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); Insets insets = c == null ? new Insets(0,0,0,0) : c.getInsets(); int width = preferredWidths[i] - (insets.left + insets.right); int x = nextX + insets.left;
Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); Insets insets = c == null ? new Insets(0,0,0,0) : c.getInsets(); int width = preferredWidths[i] - (insets.left + insets.right); int x = nextX + insets.left;
Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); Insets insets = c == null ? new Insets(0,0,0,0) : c.getInsets(); int width = preferredWidths[i] - (insets.left + insets.right); int x = nextX + insets.left;
Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); Insets insets = c == null ? new Insets(0,0,0,0) : c.getInsets(); int width = preferredWidths[i] - (insets.left + insets.right); int x = nextX + insets.left;
int prefWidth = 0; if (c != null) { Insets i = c.getInsets(); d.width += i.left + i.right; d.height += i.top + i.bottom;
public Dimension preferredLayoutSize(Container parent) { Dimension prefSize = new Dimension(); int count = 0; for (Component comp : constraints.keySet()) { Constraint c = constraints.get(comp); Dimension d = comp.getPreferredSize(); int prefWidth = 0; if (c != null) { Insets i = c.getInsets(); d.width += i.left + i.right; d.height += i.top + i.bottom; prefWidth = c.getFixedWidth(); } prefSize.height = Math.max(prefSize.height, d.height); prefSize.width += Math.max(d.width, prefWidth); //If this is not the last component, add extra space between each //component (for the separator). count++; if (includeSeparators() && constraints.size() < count) { prefSize.width += getSeparatorWidth(); } } Insets insets = parent.getInsets(); prefSize.height += insets.top + insets.bottom; prefSize.width += insets.left + insets.right; return prefSize; }
/** * @return the "preferred" width, where that means either * comp.getPreferredSize().width + constraintInsets, or * constraint.fixedWidth + constraintInsets. */ private int getPreferredWidth(Component comp) { Constraint c = constraints.get(comp); if (c == null) { return comp.getPreferredSize().width; } else { Insets insets = c.getInsets(); assert insets != null; if (c.getFixedWidth() <= 0) { return comp.getPreferredSize().width + insets.left + insets.right; } else { return c.getFixedWidth() + insets.left + insets.right; } } }
/** * @return the "preferred" width, where that means either * comp.getPreferredSize().width + constraintInsets, or * constraint.fixedWidth + constraintInsets. */ private int getPreferredWidth(Component comp) { Constraint c = constraints.get(comp); if (c == null) { return comp.getPreferredSize().width; } else { Insets insets = c.getInsets(); assert insets != null; if (c.getFixedWidth() <= 0) { return comp.getPreferredSize().width + insets.left + insets.right; } else { return c.getFixedWidth() + insets.left + insets.right; } } }
/** * @return the "preferred" width, where that means either * comp.getPreferredSize().width + constraintInsets, or * constraint.fixedWidth + constraintInsets. */ private int getPreferredWidth(Component comp) { Constraint c = constraints.get(comp); if (c == null) { return comp.getPreferredSize().width; } else { Insets insets = c.getInsets(); assert insets != null; if (c.getFixedWidth() <= 0) { return comp.getPreferredSize().width + insets.left + insets.right; } else { return c.getFixedWidth() + insets.left + insets.right; } } }
/** * @return the "preferred" width, where that means either * comp.getPreferredSize().width + constraintInsets, or * constraint.fixedWidth + constraintInsets. */ private int getPreferredWidth(Component comp) { Constraint c = constraints.get(comp); if (c == null) { return comp.getPreferredSize().width; } else { Insets insets = c.getInsets(); assert insets != null; if (c.getFixedWidth() <= 0) { return comp.getPreferredSize().width + insets.left + insets.right; } else { return c.getFixedWidth() + insets.left + insets.right; } } }
/** * @return the "preferred" width, where that means either * comp.getPreferredSize().width + constraintInsets, or * constraint.fixedWidth + constraintInsets. */ private int getPreferredWidth(Component comp) { Constraint c = constraints.get(comp); if (c == null) { return comp.getPreferredSize().width; } else { Insets insets = c.getInsets(); assert insets != null; if (c.getFixedWidth() <= 0) { return comp.getPreferredSize().width + insets.left + insets.right; } else { return c.getFixedWidth() + insets.left + insets.right; } } }