Eclipse Platform
2.0

org.eclipse.swt.custom
Class StyleRange

java.lang.Object
  |
  +--org.eclipse.swt.custom.StyleRange
All Implemented Interfaces:
Cloneable, org.eclipse.swt.internal.CloneableCompatibility

public class StyleRange
extends Object
implements org.eclipse.swt.internal.CloneableCompatibility


Field Summary
 Color background
           
 int fontStyle
           
 Color foreground
           
 int length
           
 int start
           
 
Constructor Summary
StyleRange()
           
StyleRange(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.
 
Method Summary
 Object clone()
          Answers a new StyleRange with the same values as this StyleRange.
 boolean equals(Object object)
          Compare the specified object to this StyleRange and answer if the two are equal.
 int hashCode()
          Returns an integer hash code for the receiver.
 boolean isUnstyled()
          Returns whether or not the receiver is unstyled (i.e., does not have any style attributes specified).
 boolean similarTo(StyleRange style)
          Compares the specified object to this StyleRange and answer if the two are similar.
 String toString()
          Answers a string description of the receiver.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

start

public int start

length

public int length

foreground

public Color foreground

background

public Color background

fontStyle

public int fontStyle
Constructor Detail

StyleRange

public StyleRange()

StyleRange

public StyleRange(int start,
                  int length,
                  Color foreground,
                  Color background)
Create 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

StyleRange

public StyleRange(int start,
                  int length,
                  Color foreground,
                  Color background,
                  int fontStyle)
Create 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 or SWT.BOLD
Method Detail

equals

public boolean equals(Object object)
Compare the specified object to this StyleRange and answer if the two are equal. The object must be an instance of StyleRange and have the same field values.

Overrides:
equals in class Object
Parameters:
object - the object to compare with this object
Returns:
true if the objects are equal, false otherwise

hashCode

public int hashCode()
Returns an integer hash code for the receiver. Objects which are equal answer the same value for this method.

Overrides:
hashCode in class Object
Returns:
the receiver's hash

isUnstyled

public 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.

similarTo

public boolean similarTo(StyleRange style)
Compares 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.

Returns:
true if the objects are similar, false otherwise

clone

public Object clone()
Answers a new StyleRange with the same values as this StyleRange.

Overrides:
clone in class Object
Returns:
a shallow copy of this StyleRange

toString

public String toString()
Answers a string description of the receiver.

Overrides:
toString in class Object
Returns:
a printable representation for the receiver.

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.