Package org.eclipse.swt.custom
Class StyleRange
java.lang.Object
org.eclipse.swt.graphics.TextStyle
org.eclipse.swt.custom.StyleRange
- All Implemented Interfaces:
- Cloneable
StyleRange defines a set of styles for a specified
 range of text.
 The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionintthe font style of the range.intthe length of the rangeintthe start offset of the range, zero-based from the document startFields inherited from class org.eclipse.swt.graphics.TextStylebackground, borderColor, borderStyle, data, font, foreground, metrics, rise, strikeout, strikeoutColor, underline, underlineColor, underlineStyle
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new style range with no stylesStyleRange(int start, int length, Color foreground, Color background) Create a new style range.StyleRange(int start, int length, Color foreground, Color background, int fontStyle) Create a new style range.StyleRange(TextStyle style) Create a new style range from an existing text style.
- 
Method SummaryModifier and TypeMethodDescriptionclone()Returns a new StyleRange with the same values as this StyleRange.booleanCompares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.inthashCode()Returns an integer hash code for the receiver.booleanReturns whether or not the receiver is unstyled (i.e., does not have any style attributes specified).booleansimilarTo(StyleRange style) Compares the specified object to this StyleRange and answer if the two are similar.toString()Returns a string containing a concise, human-readable description of the receiver.
- 
Field Details- 
startpublic int startthe start offset of the range, zero-based from the document start
- 
lengthpublic int lengththe length of the range
- 
fontStylepublic int fontStylethe font style of the range. It may be a combination of SWT.NORMAL, SWT.ITALIC or SWT.BOLD Note: the font style is not used if thefontattribute is set
 
- 
- 
Constructor Details- 
StyleRangepublic StyleRange()Create a new style range with no styles- Since:
- 3.2
 
- 
StyleRangeCreate a new style range from an existing text style.- Parameters:
- style- the text style to copy
- Since:
- 3.4
 
- 
StyleRangeCreate a new style range.- Parameters:
- start- start offset of the style
- length- length of the style
- foreground- foreground color of the style, null if none
- background- background color of the style, null if none
 
- 
StyleRangeCreate a new style range.- Parameters:
- start- start offset of the style
- length- length of the style
- foreground- foreground color of the style, null if none
- background- background color of the style, null if none
- fontStyle- font style of the style, may be SWT.NORMAL, SWT.ITALIC or SWT.BOLD
 
 
- 
- 
Method Details- 
equalsCompares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
- 
hashCodepublic int hashCode()Returns an integer hash code for the receiver. Any two objects that returntruewhen passed toequalsmust return the same value for this method.
- 
isUnstyledpublic boolean isUnstyled()Returns whether or not the receiver is unstyled (i.e., does not have any style attributes specified).- Returns:
- true if the receiver is unstyled, false otherwise.
 
- 
similarToCompares the specified object to this StyleRange and answer if the two are similar. The object must be an instance of StyleRange and have the same field values for except for start and length.- Parameters:
- style- the object to compare with this object
- Returns:
- true if the objects are similar, false otherwise
 
- 
cloneReturns a new StyleRange with the same values as this StyleRange.
- 
toStringReturns a string containing a concise, human-readable description of the receiver.
 
-