public void applyPropertiesTo(TableCellRenderer renderer) { if (renderer instanceof JLabel) { applyPropertiesTo( (JLabel) renderer); } else if (renderer instanceof AbstractButton) { applyPropertiesTo( (AbstractButton) renderer); } } }
@Override public Color getBackground() { return label.getBackground(); }
@Override public Font getFont() { return label.getFont(); }
public void applyPropertiesTo(LabelProperties props) { if (noPropertiesSet()) { return; if (isBackgroundSet()) { props.setBackground(getBackground()); if (isForegroundSet()) { props.setForeground(getForeground()); if (isFontSet()) { props.setFont(getFont()); if (isHorizontalAlignmentSet()) { props.setHorizontalAlignment(getHorizontalAlignment()); if (isHorizontalTextPositionSet()) { props.setHorizontalTextPosition(getHorizontalTextPosition()); if (isIconSet()) { props.setIcon(getIcon()); if (isIconTextGapSet()) { props.setIconTextGap(getIconTextGap()); if (isTextSet()) { props.setText(getText()); if (isVerticalAlignmentSet()) { props.setVerticalAlignment(getVerticalAlignment());
public void applyPropertiesTo(JLabel label) { if (noPropertiesSet()) { return; if (isBackgroundSet()) { label.setBackground(getBackground()); if (isForegroundSet()) { label.setForeground(getForeground()); if (isFontSet()) { label.setFont(getFont()); if (isHorizontalAlignmentSet()) { label.setHorizontalAlignment(getHorizontalAlignment()); if (isHorizontalTextPositionSet()) { label.setHorizontalTextPosition(getHorizontalTextPosition()); if (isIconSet()) { label.setIcon(getIcon()); if (isIconTextGapSet()) { label.setIconTextGap(getIconTextGap()); if (isTextSet()) { label.setText(getText()); if (isVerticalAlignmentSet()) { label.setVerticalAlignment(getVerticalAlignment());
public ColumnHeaderRenderer(JTableHeader header) { label = new LabelProperties(); updateUI(header); }
@Override public Color getForeground() { return label.getForeground(); }
public int getHorizontalTextPosition() { return label.getHorizontalTextPosition(); }
public int getHorizontalAlignment() { return label.getHorizontalAlignment(); }
public int getIconTextGap() { return label.getIconTextGap(); }
public Icon getIcon() { return label.getIcon(); }
public LabelProperties() { super(); addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName();
public void applyPropertiesTo(AbstractButton button) { if (noPropertiesSet()) { return; if (isBackgroundSet()) { button.setBackground(getBackground()); if (isForegroundSet()) { button.setForeground(getForeground()); if (isFontSet()) { button.setFont(getFont()); if (isHorizontalAlignmentSet()) { button.setHorizontalAlignment(getHorizontalAlignment()); if (isHorizontalTextPositionSet()) { button.setHorizontalTextPosition(getHorizontalTextPosition()); if (isIconSet()) { button.setIcon(getIcon()); if (isIconTextGapSet()) { button.setIconTextGap(getIconTextGap()); if (isTextSet()) { button.setText(getText()); if (isVerticalAlignmentSet()) { button.setVerticalAlignment(getVerticalAlignment());
public ColumnHeaderRenderer() { label = new LabelProperties(); initDelegate(); updateIconUI(); }
private void applyLabelProperties(Component delegateRendererComponent) { if (delegateRendererComponent instanceof JLabel) { label.applyPropertiesTo((JLabel) delegateRendererComponent); } else { label.applyPropertiesTo(delegateRenderer); } }