Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## swing.addon.text
Class JavaContext

    java.lang.Object
      |
      +--javax.swing.text.StyleContext
            |
            +--swing.addon.text.JavaContext

All Implemented Interfaces:
  javax.swing.text.AbstractDocument.AttributeContext, java.io.Serializable, javax.swing.text.ViewFactory

public class JavaContext
extends javax.swing.text.StyleContext
implements javax.swing.text.ViewFactory

A collection of styles used to render java text. This class also acts as a factory for the views used to represent the java documents. Since the rendering styles are based upon view preferences, the views need a way to gain access to the style settings which is facilitated by implementing the factory in the style storage. Both functionalities can be widely shared across java document views.

Version:
  1.2 05/04/98
Author:
  Timothy Prinzing
See Also:
  Serialized Form

Inner classes inherited from class javax.swing.text.StyleContext
`javax.swing.text.StyleContext.NamedStyle, javax.swing.text.StyleContext.SmallAttributeSet`

Fields inherited from class javax.swing.text.StyleContext
`DEFAULT_STYLE`

Constructor Summary
`JavaContext()` Constructs a set of styles to represent java lexical tokens.

Method Summary
`javax.swing.text.View` | `create(javax.swing.text.Element elem)`
`java.awt.Font` | `getFont(int code)` Fetch the font to use for a lexical token with the given scan value.
`java.awt.Color` | `getForeground(int code)` Fetch the foreground color to use for a lexical token with the given value.
`javax.swing.text.Style` | `getStyleForScanValue(int code)` Fetches the attribute set to use for the given scan code.

Methods inherited from class javax.swing.text.StyleContext
`addAttribute, addAttributes, addChangeListener, addStyle, createLargeAttributeSet, createSmallAttributeSet, getBackground, getCompressionThreshold, getDefaultStyleContext, getEmptySet, getFont, getFont, getFontMetrics, getForeground, getStaticAttribute, getStaticAttributeKey, getStyle, getStyleNames, readAttributes, readAttributeSet, reclaim, registerStaticAttributeKey, removeAttribute, removeAttributes, removeAttributes, removeChangeListener, removeStyle, toString, writeAttributes, writeAttributeSet`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### JavaContext

    public JavaContext()

  Constructs a set of styles to represent java lexical tokens. By default there are no colors or fonts specified.

Method Detail

### create

    public javax.swing.text.View create(javax.swing.text.Element elem)

  Specified by:
    `create` in interface `javax.swing.text.ViewFactory`

### getFont

    public java.awt.Font getFont(int code)

  Fetch the font to use for a lexical token with the given scan value.

### getForeground

    public java.awt.Color getForeground(int code)

  Fetch the foreground color to use for a lexical token with the given value.
  Parameters:
    `attr` - attribute set from a token element that has a Token in the set.

### getStyleForScanValue

    public javax.swing.text.Style getStyleForScanValue(int code)

  Fetches the attribute set to use for the given scan code. The set is stored in a table to facilitate relatively fast access to use in conjunction with the scanner.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD