Code example for JLabel

Methods: getFontsetBackgroundsetFontsetForegroundsetIcon

0
    final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (value == null) 
    { 
      return label;
    } 
    label.setBackground(Color.GRAY);
    label.setForeground(Color.WHITE);
    if (column >= 1)
    { 
      label.setText(""); //$NON-NLS-1$
      label.setIcon(null);
    } 
    else 
    { 
      final Font font = StyleContext.getDefaultStyleContext().getFont(label.getFont().getName(), Font.BOLD,
          label.getFont().getSize());
      label.setFont(font);
      final GroupingHeader groupingHeader = (GroupingHeader) value;
      final boolean isCollapsed = groupingHeader.isCollapsed();
      if (table.getModel() instanceof GroupedTableModel)
      { 
        label.setIcon(isCollapsed ? expandImage : collapseImage);
      } 
    } 
    return label;
  } 
}