/** Lay out the container's components. */ public void layoutContainer(Container parent) { Dimension parentSize = parent.getSize(); if (parentSize.height <= 0 || parentSize.width <= 0) return; if (!_valid) validate(); _yyyy.doLayout(parent); for (int r = 0; r < _xxxx.length; r++) { int ystart = _yyyy.getRowStart(r); int yheight = _yyyy.getRowHeight(r); _xxxx[r].doLayout(parent, ystart, yheight); } }
/** Get the container's preferred layout size. */ public Dimension preferredLayoutSize(Container parent) { if (!_valid) validate(); Insets insets = parent.getInsets(); int height = insets.top + insets.bottom + _yyyy.getPreferredHeight(); int width = insets.left + insets.right + _prefLayoutWidth; return new Dimension(width, height); }
/** Set a border. */ public final void setInsets(Insets inset) { _yyyy.setMargins(inset.top, inset.bottom); for (int n = 0; n < _xxxx.length; n++) { _xxxx[n].setMargins(inset.left, inset.right); } _valid = false; }
private void validate() { _valid = true; _minLayoutWidth = 0; _prefLayoutWidth = 0; for (int r = 0; r < _xxxx.length; r++) { WidthManager wm = _xxxx[r]; wm.validate(); _yyyy.setPreferredRowHeight(r, wm.getPreferredHeight()); int w = wm.getPreferredWidth(); if (w > _prefLayoutWidth) _prefLayoutWidth = w; _yyyy.setMinimumRowHeight(r, wm.getMinimumHeight()); w = wm.getMinimumWidth(); if (w > _minLayoutWidth) _minLayoutWidth = w; } _yyyy.validate(); }
/** Set a row's weight. The default weight of any row is 0.0f. */ public final void setRowWeight(int row, float weight) { _yyyy.setRowWeight(row, weight); }
/** Set a row weight for all rows. The default weight of any row is 0.0f. */ public final void setRowWeight(float weight) { _yyyy.setRowWeight(weight); }
/** * Set the vertical gap, which is the gap between rows. The default is zero pixels. It does not * apply to the outside border. */ public final void setVgap(int gap) { _yyyy.setGap(gap); _valid = false; }