Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.swt.custom
Class StyleRange

java.lang.Object
  extended by 

org.eclipse.swt.graphics.TextStyle
      extended by 
org.eclipse.swt.custom.StyleRange
All Implemented Interfaces:
Cloneable, org.eclipse.swt.internal.CloneableCompatibility

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

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:
Sample code and further information

Field Summary
 int fontStyle
          the font style of the range.
 int length
          the length of the range
 int start
          the start offset of the range, zero-based from the document start
 
Fields inherited from class org.eclipse.swt.graphics. TextStyle
background, borderColor, borderStyle, data, font, foreground, metrics, rise, strikeout, strikeoutColor, underline, underlineColor, underlineStyle
 
Constructor Summary
StyleRange ()
          Create a new style range with no styles
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.
StyleRange ( TextStyle style)
          Create a new style range from an existing text style.
 
Method Summary
  Object clone ()
          Returns a new StyleRange with the same values as this StyleRange.
 boolean equals ( Object object)
          Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.
 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 ()
          Returns a string containing a concise, human-readable description of the receiver.
 
Methods inherited from class java.lang. Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

start

public int start
the start offset of the range, zero-based from the document start


length

public int length
the length of the range


fontStyle

public int fontStyle
the 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 the font attribute is set

Constructor Detail

StyleRange

public StyleRange()
Create a new style range with no styles

Since:
3.2

StyleRange

public StyleRange(
TextStyle style)
Create a new style range from an existing text style.

Parameters:
style - the text style to copy
Since:
3.4

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, SWT.ITALIC or SWT.BOLD
Method Detail

equals

public boolean equals(
Object object)
Compares the argument to the receiver, and returns true if they represent the same object using a class specific comparison.

Overrides:
equals in class TextStyle
Parameters:
object - the object to compare with this object
Returns:
true if the object is the same as this object and false otherwise
See Also:
hashCode()

hashCode

public int hashCode()
Returns an integer hash code for the receiver. Any two objects that return true when passed to equals must return the same value for this method.

Overrides:
hashCode in class TextStyle
Returns:
the receiver's hash
See Also:
equals(Object)

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.

Parameters:
style - the object to compare with this object
Returns:
true if the objects are similar, false otherwise

clone

public 
Object clone()
Returns 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()
Returns a string containing a concise, human-readable description of the receiver.

Overrides:
toString in class TextStyle
Returns:
a string representation of the StyleRange

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire