|
JHotDraw 7.4.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.JFormattedTextField.AbstractFormatter
javax.swing.text.DefaultFormatter
org.jhotdraw.text.ColorFormatter
public class ColorFormatter
ColorFormatter is used to format colors into a textual representation
which can be edited in an entry field.
The following formats are supported:
#rrggbb or #rgb .
If 6 digits are entered, each pair of hexadecimal digits, in the range 0
to F, represents one sRGB color component in the order red, green and blue.
The digits A to F may be in either uppercase or lowercase.#9400D3 (i.e. a dark violet), #FFD700
(i.e. a golden color), #000 (i.e. black) #fff (i.e. white),
#6CF (i.e. #66CCFF.
rrr, ggg, bbb. Each integer represents one sRGB
color component in the order red, green and blue, separated by a comma and
optionally by white space. Each integer is in the range 0 to 255.
This syntactical form can represent 16777216 colors.
Examples: 233, 150, 122 (i.e. a salmon pink), 255, 165, 0
(i.e. an orange).
By default, the formatter formats Color objects with Format.RGB_INTEGER.
| Nested Class Summary | |
|---|---|
static class |
ColorFormatter.Format
Specifies the formats supported by ColorFormatter. |
| Constructor Summary | |
|---|---|
ColorFormatter()
|
|
ColorFormatter(ColorFormatter.Format outputFormat,
boolean allowsNullValue,
boolean isAdaptive)
|
|
| Method Summary | |
|---|---|
static javax.swing.JFormattedTextField.AbstractFormatterFactory |
createFormatterFactory()
Convenience method for creating a formatter factory with a ColorFormatter. |
static javax.swing.JFormattedTextField.AbstractFormatterFactory |
createFormatterFactory(ColorFormatter.Format outputFormat,
boolean allowsNullValue,
boolean isAdaptive)
Convenience method for creating a formatter factory with a 8@code ColorFormatter}. |
boolean |
getAllowsNullValue()
Returns true, if null value is allowed. |
ColorFormatter.Format |
getLastUsedInputFormat()
Gets the last used input format. |
ColorFormatter.Format |
getOutputFormat()
Gets the output format. |
boolean |
isAdaptive()
Returns true, if the color formatter is adaptive. |
void |
setAdaptive(boolean newValue)
Sets whether the color formatter adaptively selects its output format depending on the last input format used by the user. |
void |
setAllowsNullValue(boolean newValue)
Sets whether a null value is allowed. |
void |
setOutputFormat(ColorFormatter.Format newValue)
Sets the output format. |
java.lang.Object |
stringToValue(java.lang.String str)
|
java.lang.String |
valueToString(java.lang.Object value)
|
| Methods inherited from class javax.swing.text.DefaultFormatter |
|---|
clone, getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, install, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass |
| Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter |
|---|
getActions, getFormattedTextField, invalidEdit, setEditValid, uninstall |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ColorFormatter()
public ColorFormatter(ColorFormatter.Format outputFormat,
boolean allowsNullValue,
boolean isAdaptive)
| Method Detail |
|---|
public void setOutputFormat(ColorFormatter.Format newValue)
newValue - public ColorFormatter.Format getOutputFormat()
public ColorFormatter.Format getLastUsedInputFormat()
public void setAllowsNullValue(boolean newValue)
newValue - public boolean getAllowsNullValue()
public void setAdaptive(boolean newValue)
newValue - public boolean isAdaptive()
public java.lang.Object stringToValue(java.lang.String str)
throws java.text.ParseException
stringToValue in class javax.swing.text.DefaultFormatterjava.text.ParseException
public java.lang.String valueToString(java.lang.Object value)
throws java.text.ParseException
valueToString in class javax.swing.text.DefaultFormatterjava.text.ParseExceptionpublic static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory()
ColorFormatter.
Uses the RGB_INTEGER format, allows null values and is adaptive.
public static javax.swing.JFormattedTextField.AbstractFormatterFactory createFormatterFactory(ColorFormatter.Format outputFormat,
boolean allowsNullValue,
boolean isAdaptive)
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||