|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.util.swing.JCSwingTypeConverter
JCSwingTypeConverter
contains static methods for converting
to/from AWT and Swing data types.
Field Summary | |
static String[] |
horizontalAlignmentStrings
|
static int[] |
horizontalAlignmentValues
|
static String[] |
justificationStrings
|
static int[] |
justificationValues
|
static Color |
lightBlue
The color light blue. |
static String[] |
positionStrings
|
static int[] |
positionValues
|
static String[] |
verticalAlignmentStrings
|
static int[] |
verticalAlignmentValues
|
Constructor Summary | |
JCSwingTypeConverter()
|
Method Summary | |
static String |
fromBorder(Border border,
Component comp)
Returns border in format "name|param|param". |
static String |
fromColor(Color c)
Converts color to one of the Color enums, or format "r-g-b" . |
static String |
fromColorList(Color[] list)
Converts list to a comma-separated list of tokens. |
static String |
fromFont(Font f)
Returns font in format "name-style-size". |
static String |
fromInsets(Insets insets)
Creates a String from an awt Insets value. |
static String |
fromInsetsToIntList(Insets insets)
Converts an Insets object to a code String list of integers. |
static String |
fromInsetsToIntList(Insets insets,
String separator)
Converts an Insets object to a code String list of integers. |
static float |
getHorizontalAWTFromSwingConstant(int swingValue,
float defaultValue,
boolean isLeftToRight)
Spits out an AWT alignment float from the equivalent SwingConstant enum. |
static int |
getHorizontalSwingConstantFromAWT(float componentAlignment,
int defaultValue)
Takes in an AWT alignment float, and spits out the equivalent SwingConstant enum. |
static Color |
getMatteBorderColor(MatteBorder matte,
Component comp)
As of JDK 1.3, MatteBorder has a getMatteColor()
method. |
static float |
getVerticalAWTFromSwingConstant(int swingValue,
float defaultValue)
Spits out an AWT alignment float from the equivalent SwingConstant enum. |
static int |
getVerticalSwingConstantFromAWT(float componentAlignment,
int defaultValue)
Takes in an AWT alignment float, and spits out the equivalent SwingConstant enum. |
static Border |
toBorder(String s)
Converts a border name in format "name|param|param|etc."; for example, "empty|10|10|10|10" |
static Color |
toColor(String s)
Converts a String to a Color . |
static Color |
toColor(String s,
Color def)
Converts a String to a Color . |
static Color[] |
toColorList(String s)
Converts a String to an array of Color s. |
static Color[] |
toColorList(String s,
Color[] def)
Converts a String to an array of Color s. |
static Dimension |
toDimension(String s,
Dimension def)
Converts a String to a Dimension instance. |
static Font |
toFont(String s)
Converts a font name in format "name-style-size", e.g. |
static Font |
toFont(String s,
Font def)
Converts a font name to a Font instance. |
static Insets |
toInsets(String s,
Insets def)
Converts a String to an Insets instance. |
static Point |
toPoint(String s,
Point def)
Converts a String to a Point instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Color lightBlue
public static final int[] positionValues
public static final String[] positionStrings
public static final int[] justificationValues
public static final String[] justificationStrings
public static final int[] horizontalAlignmentValues
public static final String[] horizontalAlignmentStrings
public static final int[] verticalAlignmentValues
public static final String[] verticalAlignmentStrings
Constructor Detail |
public JCSwingTypeConverter()
Method Detail |
public static Color[] toColorList(String s, Color[] def)
Color
s.
s
- the String containing color names separated by commasdef
- the default value, returned if a parse error occurs
public static Color[] toColorList(String s)
Color
s.
s
- the comma-separated color names
public static Color toColor(String s, Color def)
Color
.
s
- the String containing a color namedef
- the default value, returned if a parse error occurs
Color
public static Color toColor(String s)
Color
.
s
- a color enum ("black", "pink", etc.);
hex value in format "#RRGGBB", "#RRRRGGGGBBBB" or "#N";
or rgb values in format "r-g-b"
Color
public static String fromColorList(Color[] list)
list
- the list of colors to be converted to a string
fromColor(java.awt.Color)
public static String fromColor(Color c)
Color
enums, or format "r-g-b" .
c
- the color to be converted
public static Font toFont(String s, Font def)
Font
instance.
s
- the String containing font namedef
- the default value, returned if a parse error occurs
public static Font toFont(String s)
s
- the String representation of the Font
public static String fromFont(Font f)
f
- the font to be converted to a String
public static Insets toInsets(String s, Insets def)
Insets
instance.
s
- the String containing the top, left, bottom, and right
values, separated by commasdef
- the default value, returned if the String could not be converted
Insets
object created from the Stringpublic static String fromInsets(Insets insets)
Insets
value.
insets
- the Insets
Returns:Insets
object passed inpublic static Dimension toDimension(String s, Dimension def)
Dimension
instance.
s
- the String in the format [width]x[height]def
- the default value, returned if the String could not be converted
Dimension
object created from the Stringpublic static Point toPoint(String s, Point def)
Point
instance.
s
- the String in the format [x],[y]def
- the default value, returned if the String could not be converted
Point
object created from the Stringpublic static String fromInsetsToIntList(Insets insets)
Insets
object to a code String list of integers.
insets
- an Insets
object
public static String fromInsetsToIntList(Insets insets, String separator)
Insets
object to a code String list of integers.
insets
- an Insets
objectseparator
- the separator used between each number
public static Border toBorder(String s)
s
- the String to convert to a Border
object
public static String fromBorder(Border border, Component comp)
border
- the border object to convertcomp
- the component to get default values from (for example: insets, colors)
public static Color getMatteBorderColor(MatteBorder matte, Component comp)
MatteBorder
has a getMatteColor()
method. See if its there and invoke if it is. Otherwise, return the
component's background color.
matte
- the MatteBorder
from which the color is neededcomp
- the component which holds the border
MatteBorder
's colorpublic static int getVerticalSwingConstantFromAWT(float componentAlignment, int defaultValue)
componentAlignment
- defaultValue
- the value to return if the value is not found.
public static int getHorizontalSwingConstantFromAWT(float componentAlignment, int defaultValue)
componentAlignment
- defaultValue
- the value to return if the value is not found.
public static float getVerticalAWTFromSwingConstant(int swingValue, float defaultValue)
swingValue
- defaultValue
- the value to return if the value is not found.
public static float getHorizontalAWTFromSwingConstant(int swingValue, float defaultValue, boolean isLeftToRight)
swingValue
- defaultValue
- the value to return if the value is not found.isLeftToRight
- determines whether trailing and leading are
right or left respectively (Can be determinded by calling
Component.getComponentOrientation.isLeftToRight();
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |