/** * Sets if the color defined by StyleRange should be ignored. This flag is used when StyledLabel is used as a * selected cell renderer. Since the selection usually has it own unique selection background and foreground, the * color setting set on this StyledLabel could be unreadable on the selection background, it'd better if we don't * use any color settings in this case. * * @param ignoreColorSettings true or false. */ public void setIgnoreColorSettings(boolean ignoreColorSettings) { boolean old = _ignoreColorSettings; if (old != ignoreColorSettings) { _ignoreColorSettings = ignoreColorSettings; firePropertyChange(PROPERTY_IGNORE_COLOR_SETTINGS, old, ignoreColorSettings); } }
/** * Overridden for performance reasons. See the <a href="#override">Implementation Note</a> for more information. */ @Override protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { // Strings get interned... if (propertyName.equals("text")) super.firePropertyChange(propertyName, oldValue, newValue); }
/** * Overridden for performance reasons. See the <a href="#override">Implementation Note</a> for more information. */ @Override protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { // Strings get interned... if (propertyName.equals("text")) super.firePropertyChange(propertyName, oldValue, newValue); }
/** * Adds a list of StyleRanges into this <code>StyledLabel</code>. * * @param styleRanges an array of StyleRanges. */ public synchronized void addStyleRanges(StyleRange[] styleRanges) { if (styleRanges != null) { for (StyleRange styleRange : styleRanges) { internalGetStyleRanges().add(styleRange); } firePropertyChange(PROPERTY_STYLE_RANGE, null, styleRanges); } else { firePropertyChange(PROPERTY_STYLE_RANGE, null, null); } }
/** * Removes the StyleRange. * * @param styleRange the StyleRange to be removed. */ public synchronized void clearStyleRange(StyleRange styleRange) { if (internalGetStyleRanges().remove(styleRange)) { firePropertyChange(PROPERTY_STYLE_RANGE, styleRange, null); } }
/** * Clears all the StyleRanges. */ public synchronized void clearStyleRanges() { internalGetStyleRanges().clear(); firePropertyChange(PROPERTY_STYLE_RANGE, null, null); }
/** * Adds a StyleRange into this <code>StyledLabel</code>. * * @param styleRange the new StyleRange. */ public synchronized void addStyleRange(StyleRange styleRange) { if (styleRange == null) { throw new IllegalArgumentException("StyleRange cannot be null."); } List<StyleRange> ranges = internalGetStyleRanges(); for (int i = ranges.size() - 1; i >= 0; i--) { StyleRange range = ranges.get(i); if (range.getStart() == styleRange.getStart() && range.getLength() == styleRange.getLength()) { ranges.remove(i); } } internalGetStyleRanges().add(styleRange); firePropertyChange(PROPERTY_STYLE_RANGE, null, styleRange); }