|
org.netbeans.modules.editor.lib/3 3.23.0 19 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.editor.Coloring
public final class Coloring
Immutable class that stores font and foreground and background colors. The coloring can be applied to either the drawing context, component or some other coloring. Applying first checks whether each of the font and the colors is non-null. If it's null the particular thing is left unchanged. For example to change the background color only the Coloring must be created with the font and foreground color being null. It's also possible to use a more advanced way to apply the coloring by using the modes. There are two modes - font-mode and color-mode. The deafult font-mode simply overwrites the whole font. The font-mode constants allow to change the underlying font by only changing some of the font-name, style or size. The FONT_MODE_APPLY_STYLE for example will only apply the style of the coloring's font. The "rest" of the coloring's font (name and size in this case) is not used so there can be any valid values ("Monospaced" and 12 for example). The colors can use the alpha value. It's also possible to set the color of the underline line or the color of the strikethrough line. Generally the editor uses two sets of the colorings to colorize the text. They are component-set and printing-set. The component-set is used for the editor component while the printing-set is used solely for colorizing the printed text.
| Field Summary | |
|---|---|
static int |
FONT_MODE_APPLY_NAME
Apply only the name from the font. |
static int |
FONT_MODE_APPLY_SIZE
Apply only the size from the font. |
static int |
FONT_MODE_APPLY_STYLE
Apply only the style from the font. |
static int |
FONT_MODE_DEFAULT
Replace the underlying font by the coloring's font. |
| Constructor Summary | |
|---|---|
Coloring()
Construct empty coloring |
|
Coloring(Font font,
Color foreColor,
Color backColor)
Construct new coloring |
|
Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor)
Construct new coloring |
|
Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor,
Color underlineColor,
Color strikeThroughColor)
Construct new coloring |
|
Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor,
Color underlineColor,
Color strikeThroughColor,
Color waveUnderlineColor)
Construct new coloring |
|
Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor,
Color underlineColor,
Color strikeThroughColor,
Color waveUnderlineColor,
Color topBorderLineColor,
Color rightBorderLineColor,
Color bottomBorderLineColor,
Color leftBorderLineColor)
|
|
| Method Summary | |
|---|---|
Coloring |
apply(Coloring c)
Apply this coloring to some other coloring c and return the resulting coloring. |
void |
apply(JComponent c)
Apply this coloring to component colors/font. |
static Coloring |
changeBackColor(Coloring c,
Color newBackColor)
Derive a new coloring by changing the background-color and its color-mode and leaving the rest of the coloring unchanged. |
static Coloring |
changeFont(Coloring c,
Font newFont)
Derive a new coloring by changing the font and leaving the rest of the coloring (including the font-mode) unchanged. |
static Coloring |
changeFont(Coloring c,
Font newFont,
int newFontMode)
Derive a new coloring by changing the font and font-mode and leaving the rest of the coloring unchanged. |
static Coloring |
changeForeColor(Coloring c,
Color newForeColor)
Derive a new coloring by changing the foreground-color and its color-mode and leaving the rest of the coloring unchanged. |
boolean |
equals(Object o)
All font, foreColor and backColor are the same. |
static Coloring |
fromAttributeSet(AttributeSet as)
Converts AttributeSet to a Coloring. |
Color |
getBackColor()
Getter for background color |
Color |
getBottomBorderLineColor()
Getter for bottom border line color |
Font |
getFont()
Getter for font |
int |
getFontMode()
Getter for font-mode |
Color |
getForeColor()
Getter for foreground color |
Color |
getLeftBorderLineColor()
Getter for left border line color |
Color |
getRightBorderLineColor()
Getter for right border line color |
Color |
getStrikeThroughColor()
Getter for strikethrough line color |
Color |
getTopBorderLineColor()
Getter for top border line color |
Color |
getUnderlineColor()
Getter for underline line color |
Color |
getWaveUnderlineColor()
Getter for wave underline line color |
int |
hashCode()
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int FONT_MODE_APPLY_NAME
public static final int FONT_MODE_APPLY_STYLE
public static final int FONT_MODE_APPLY_SIZE
public static final int FONT_MODE_DEFAULT
| Constructor Detail |
|---|
public Coloring()
public Coloring(Font font,
Color foreColor,
Color backColor)
public Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor)
public Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor,
Color underlineColor,
Color strikeThroughColor)
public Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor,
Color underlineColor,
Color strikeThroughColor,
Color waveUnderlineColor)
public Coloring(Font font,
int fontMode,
Color foreColor,
Color backColor,
Color underlineColor,
Color strikeThroughColor,
Color waveUnderlineColor,
Color topBorderLineColor,
Color rightBorderLineColor,
Color bottomBorderLineColor,
Color leftBorderLineColor)
| Method Detail |
|---|
public Font getFont()
public int getFontMode()
public Color getForeColor()
public Color getBackColor()
public Color getUnderlineColor()
public Color getWaveUnderlineColor()
public Color getStrikeThroughColor()
public Color getTopBorderLineColor()
public Color getRightBorderLineColor()
public Color getBottomBorderLineColor()
public Color getLeftBorderLineColor()
public void apply(JComponent c)
public Coloring apply(Coloring c)
c - coloring to which this coloring will be applied.
If it's null then this coloring will be returned as result.public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
public static Coloring changeFont(Coloring c,
Font newFont)
public static Coloring changeFont(Coloring c,
Font newFont,
int newFontMode)
public static Coloring changeForeColor(Coloring c,
Color newForeColor)
public static Coloring changeBackColor(Coloring c,
Color newBackColor)
public String toString()
toString in class Objectpublic static Coloring fromAttributeSet(AttributeSet as)
AttributeSet to a Coloring. This method
will extract any font related information as well as the 'well-known' colors
from the AttributeSet passed in and will use them for creating
a Coloring instance that will be returned.
The list of supported colors:
StyleConstants.Foreground
StyleConstants.Background
StyleConstants.Underline
StyleConstants.StrikeThrough
EditorStyleConstants.WaveUnderlineColor
as - The AttributeSet to convert.
Coloring that will contain font and color information
from the supplied AttributeSet.
|
org.netbeans.modules.editor.lib/3 3.23.0 19 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||