// Add new labels header labels
int columnCounter = 0;
int lastVisibleColumn = this.getLastVisibleColumn();
boolean isFirstVisible = true;
for (int i=0; i<this.columns.size(); i++) {
OutlineColumnDesc colDec = (OutlineColumnDesc)this.columns.get(i);
if (colDec.getState() != Constants.FS_INVISIBLE) {
String columnName = colDec.getTitle().asString();
gbc = new GridBagConstraints();
// CraigM:16/12/2008 - Cater for the fact that the control space pad is on the right of the first column
if (isFirstVisible) {
gbc.gridx = 0;
isFirstVisible = false;
}
else {
gbc.gridx = columnCounter+1;
}
gbc.gridy = 0;
// The last label fills up the rest of the space
if (i == lastVisibleColumn) {
gbc.weightx = 1;
}
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0,0,0,OutlineField.cCOLUMN_SPACING); // Put a gap between the columns
JLabel headerLabel = new JLabel(columnName);
if (this.titleFont != null){
headerLabel.setFont(this.titleFont);
}
// Set the column alignment
switch (colDec.getAlignment()) {
case Constants.TA_RIGHT:
headerLabel.setHorizontalAlignment(SwingConstants.RIGHT);
break;
case Constants.TA_CENTER:
headerLabel.setHorizontalAlignment(SwingConstants.CENTER);