@Override public void addLayoutComponent(Component comp, Object constraint) { //we accept an Insets, a ResizeBehavior, or a Constraint. if (constraint instanceof Insets) { constraint = new Constraint((Insets)constraint); } else if (constraint instanceof Constraint.ResizeBehavior) { constraint = new Constraint((Constraint.ResizeBehavior)constraint); } constraints.put(comp, (Constraint)constraint); }
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();
for (Component comp : parent.getComponents()) { Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { numFilledComponents++; Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { if (remaining > 1) { preferredWidths[i] += share; 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;
for (Component comp : parent.getComponents()) { Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { numFilledComponents++; Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { if (remaining > 1) { preferredWidths[i] += share; 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;
for (Component comp : parent.getComponents()) { Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { numFilledComponents++; Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { if (remaining > 1) { preferredWidths[i] += share; 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;
for (Component comp : parent.getComponents()) { Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { numFilledComponents++; Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { if (remaining > 1) { preferredWidths[i] += share; 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;
for (Component comp : parent.getComponents()) { Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { numFilledComponents++; Component comp = parent.getComponent(i); Constraint c = constraints.get(comp); if (c != null && c.getResizeBehavior() == Constraint.ResizeBehavior.FILL) { if (remaining > 1) { preferredWidths[i] += share; 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;
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; }
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();
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();
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();
/** * @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; } } }
public static JXStatusBar.Constraint getStatusLabelConstraint() { return new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL); }
@Override public void addLayoutComponent(Component comp, Object constraint) { //we accept an Insets, a ResizeBehavior, or a Constraint. if (constraint instanceof Insets) { constraint = new Constraint((Insets)constraint); } else if (constraint instanceof Constraint.ResizeBehavior) { constraint = new Constraint((Constraint.ResizeBehavior)constraint); } constraints.put(comp, (Constraint)constraint); }
public static JXStatusBar createStatusBar(final JComponent comp) { final JXStatusBar statusBar = new JXStatusBar(); statusBar.setUI(new MetalStatusBarUI()); statusBar.putClientProperty(BasicStatusBarUI.AUTO_ADD_SEPARATOR, false); statusBar.setBackground(WidgetUtils.BG_COLOR_DARKEST); final MatteBorder outerBorder = new MatteBorder(1, 0, 0, 0, WidgetUtils.BG_COLOR_LESS_DARK); final EmptyBorder innerBorder = new EmptyBorder(2, 2, 2, 2); statusBar.setBorder(new CompoundBorder(outerBorder, innerBorder)); final JXStatusBar.Constraint c1 = new JXStatusBar.Constraint(JXStatusBar.Constraint.ResizeBehavior.FILL); statusBar.add(comp, c1); return statusBar; }
public static JXStatusBar.Constraint getSeparatorConstraint() { JXStatusBar.Constraint c = new JXStatusBar.Constraint(); c.setFixedWidth(6); return c; }