Extension SDK 10.1.2

oracle.javatools.editor.highlight
Class HighlightStyle

java.lang.Object
  extended byoracle.javatools.editor.highlight.HighlightStyle

public final class HighlightStyle
extends java.lang.Object

The HighlightStyle class defines a set of foreground and background color attributes used for painting highlights for a segment of text. This is useful for highlighting certain segments of text to the user's attention, such as find text occurrences, compiler errors, breakpoints, and so on. Create new highlights or modify existing highlights through the HighlightRegistry.

A HighlightStyle must define either a foreground attribute, a background attribute, or both. Text highlights are applied in layers to styled text (such as syntax highlighted text) based on the priority of the highlight - this is similar to how the priority levels work in a JLayeredPane. Note that the highlight does not change the font attributes used for the highlighted text however. In general, do not define highlights with a higher priority level then the priority level for the selected text unless you want the particular highlight to really stand out.

As a final note, text highlights are never merged, even in cases where one overlapping highlight defines only one color attribute (say, foreground), and the other overlapping highlight defines another color attribute (say, background.) In this case, if the first highlight (with the foreground color) has a higher priority, the text will be painted with the foreground of the highlight, and background of the underlying styled text.


Field Summary
static int DEFAULT_SELECTION_PRIORITY
          The default priority level given to the highlight for selected text.
static int MAXIMUM_PRIORITY
          The maximum priority level a highlight can use.
static int MINIMUM_PRIORITY
          The minimum priority level a highlight can use.
 
Method Summary
 java.awt.Color getBackgroundColor()
          Fetches the background color of the higlight
 boolean getEnabled()
          Fetches the enabled status of this highlight style.
 java.awt.Color getForegroundColor()
          Fetches the foreground color of the highlight
 java.lang.String getName()
          Fetches the name of the highlight.
 java.lang.String getPresentationName()
          Fetch the visible or presentation name of the style.
 int getPriority()
          Fetches the priority of the highlight
 boolean getUseBackgroundColor()
          Fetches whether the background color is in use or not.
 boolean getUseForegroundColor()
          Fetches whether the foreground color is in use or not.
 java.lang.String toString()
          Fetches the human-readable name of the style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MINIMUM_PRIORITY

public static final int MINIMUM_PRIORITY
The minimum priority level a highlight can use.

See Also:
Constant Field Values

MAXIMUM_PRIORITY

public static final int MAXIMUM_PRIORITY
The maximum priority level a highlight can use.

See Also:
Constant Field Values

DEFAULT_SELECTION_PRIORITY

public static final int DEFAULT_SELECTION_PRIORITY
The default priority level given to the highlight for selected text.

See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Fetches the name of the highlight.

Returns:
the highlight name

getPresentationName

public java.lang.String getPresentationName()
Fetch the visible or presentation name of the style. This is generally a translated name that can be used for UI purposes.

Returns:
the visible or presentation name of the style

toString

public java.lang.String toString()
Fetches the human-readable name of the style.

Returns:
the style name

getEnabled

public boolean getEnabled()
Fetches the enabled status of this highlight style.

Returns:
whether this style is enabled or not

getPriority

public int getPriority()
Fetches the priority of the highlight

Returns:
the priority of the highlight

getUseForegroundColor

public boolean getUseForegroundColor()
Fetches whether the foreground color is in use or not.

Returns:
whether the foreground color is in use

getForegroundColor

public java.awt.Color getForegroundColor()
Fetches the foreground color of the highlight

Returns:
the foreground color

getUseBackgroundColor

public boolean getUseBackgroundColor()
Fetches whether the background color is in use or not.

Returns:
whether the background color is in use

getBackgroundColor

public java.awt.Color getBackgroundColor()
Fetches the background color of the higlight

Returns:
the background color

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.