/** * Relayout components after components have been added or removed. */ protected void layoutComponents() { // Remove and re-add all components in inverse insertion order (adding from right-to-left). this.removeAll(); this.add(textl, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2,4,4,2), 0, 0)); int pos = components.size(); for(Iterator it=components.values().iterator(); it.hasNext(); ) { this.add((Component)it.next(), new GridBagConstraints(pos--, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0, 0)); } this.invalidate(); this.doLayout(); this.repaint(); }