oracle.cabo.share.text
Class RGBColorFormat
java.lang.Object
|
+--java.text.Format
|
+--oracle.cabo.share.text.ColorFormat
|
+--oracle.cabo.share.text.RGBColorFormat
- All Implemented Interfaces:
- java.lang.Cloneable, java.io.Serializable
- public class RGBColorFormat
- extends ColorFormat
Format for colors.
Color Format Syntax:
To specify the color format use a color pattern string. In this pattern, all ASCII letters are reserved as pattern letters, which are defined as the following:
Symbol | Meaning | Presentation | Example |
r | red component | (Number) | 242 |
g | green component | (Number) | 242 |
b | blue component | (Number) | 242 |
a | alpha component | (Number) | 255 |
R | red component | (Hex) | F2 |
G | green component | (Hex) | F2 |
B | blue component | (Hex) | F2 |
A | alpha component | (Hex) | FF |
' | escape for text | (Delimiter) | |
'' | single quote | (Literal) | ' |
---|
Examples:
Format Pattern | Result |
"#RRGGBB" | #6609CC |
"rrr,ggg,bbb" | 102,009,204 |
"t" | Transparent (when alpha is zero) |
- See Also:
- Serialized Form
Constructor Summary |
RGBColorFormat(java.lang.String pattern)
Creates a RGBColorFormat with the specified pattern. |
Method Summary |
java.lang.StringBuffer |
format(java.awt.Color color, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
|
int |
length()
|
java.lang.Object |
parseObject(java.lang.String text, java.text.ParsePosition pos)
Returns the value as a Color. |
Methods inherited from class java.text.Format |
clone, format |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RGBColorFormat
public RGBColorFormat(java.lang.String pattern)
- Creates a RGBColorFormat with the specified pattern.
-
- Parameters:
pattern
- the color format pattern
parseObject
public java.lang.Object parseObject(java.lang.String text,
java.text.ParsePosition pos)
- Returns the value as a Color.
-
- Overrides:
parseObject
in class ColorFormat
format
public java.lang.StringBuffer format(java.awt.Color color,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
-
- Overrides:
format
in class ColorFormat
length
public int length()