/** * Add a component to the layout. * * @param comp A component * @param constraint This must be a RowLayout.Constraint object. */ public void addLayoutComponent(Component comp, Object constraint) { _valid = false; if (constraint instanceof Constraint) { Constraint r = (Constraint) constraint; if (r.row >= _xxxx.length) { throw new IllegalArgumentException("Bad constraint row number"); } else { WidthManager wm = _xxxx[r.row]; wm.addComponent(comp, r.weight); } } else { throw new IllegalArgumentException("The constraint must be RowLayout.Constraint"); } }
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(); }