Component[] components = representativeButtonsPanel.getComponents();
int finalCol = (index * 2 + 2);
Map<Integer, Double> olds = new Hashtable<Integer, Double>();
for (Component component : components) {
TableLayoutConstraints constraints = representativeButtonsPanelLayout.getConstraints(component);
if (constraints.col1 >= finalCol) {
int newCol1 = constraints.col1 + 2;
representativeButtonsPanelLayout.setConstraints(component,
new TableLayoutConstraints(
newCol1 + ",1,"
));
olds.put(newCol1, representativeButtonsPanelLayout.getColumn(newCol1));
Double colSize = olds.get(constraints.col1);
if (colSize == null)
colSize = representativeButtonsPanelLayout.getColumn(constraints.col1);
representativeButtonsPanelLayout.setColumn(newCol1, colSize);
}
}
representativeButtonsPanelLayout.setColumn(finalCol, width);
representativeButtonsPanel.add(representativeAnchor, (index * 2 + 2) + ",1,");
} else
representativeButtonsPanel.add(representativeAnchor, (representativeButtonsPanelLayout.getNumColumn() - 1) + ",1,");
} else {
int height = Math.max(representativeAnchor.getHeight(),
Math.max(representativeAnchor.getPreferredSize().height,
representativeAnchor.getSize().height)) + 12;
representativeButtonsPanelLayout.insertRow(representativeButtonsPanelLayout.getNumRow(), representativeButtonsPanelLayout.getNumRow() > 0 ? 5 : 1);
representativeButtonsPanelLayout.insertRow(representativeButtonsPanelLayout.getNumRow(), height);
if (index >= 0) {
Component[] components = representativeButtonsPanel.getComponents();
int finalRow = (index * 2 + 2);
Map<Integer, Double> olds = new Hashtable<Integer, Double>();
for (Component component : components) {
TableLayoutConstraints constraints = representativeButtonsPanelLayout.getConstraints(component);
if (constraints.row1 >= finalRow) {
int newRow1 = constraints.row1 + 2;
representativeButtonsPanelLayout.setConstraints(component,
new TableLayoutConstraints(
"1," + newRow1
));
olds.put(newRow1, representativeButtonsPanelLayout.getRow(newRow1));
Double rowSize = olds.get(constraints.row1);