Package com.alexandriasoftware.swing
Class JInputValidatorPreferences
- java.lang.Object
-
- com.alexandriasoftware.swing.JInputValidatorPreferences
-
public class JInputValidatorPreferences extends Object
Preferences for a JInputValidator. By default the preferences are pulled from aPreferences
object for the packagecom.alexandriasoftware.swing
with the following keys:- font (String)
- Path to a font that can be loaded using
Class.getResourceAsStream(java.lang.String)
. - unknown.icon (String)
- The character or Unicode sequence for the character that represents
Validation.Type.UNKNOWN
- unknown.color (int)
- The color that represents
Validation.Type.UNKNOWN
- information.icon (String)
- The character or Unicode sequence for the character that represents
Validation.Type.INFORMATION
- information.color (int)
- The color that represents
Validation.Type.INFORMATION
- success.icon (String)
- The character or Unicode sequence for the character that represents
Validation.Type.SUCCESS
- success.color (int)
- The color that represents
Validation.Type.SUCCESS
- warning.icon (String)
- The character or Unicode sequence for the character that represents
Validation.Type.WARNING
- warning.color (int)
- The color that represents
Validation.Type.WARNING
- danger.icon (String)
- The character or Unicode sequence for the character that represents
Validation.Type.DANGER
- danger.color (int)
- The color that represents
Validation.Type.DANGER
- Author:
- Randall Wood
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Color
getColor(Validation.Type type)
Get the icon for the specified type.Font
getFont()
Get the font to use.String
getIcon(Validation.Type type)
Get the icon for the specified type.static JInputValidatorPreferences
getPreferences()
Get the default preferences object.static JInputValidatorPreferences
getPreferences(Preferences preferences)
Get a set of preferences using aPreferences
object.
-
-
-
Method Detail
-
getPreferences
public static JInputValidatorPreferences getPreferences()
Get the default preferences object. This object uses the defaultPreferences
, so application-wide defaults can be set by setting preferences keys appropriately before calling this method.- Returns:
- the default preferences
-
getPreferences
public static JInputValidatorPreferences getPreferences(Preferences preferences)
Get a set of preferences using aPreferences
object. The Preferences must contain the keys listed above, but not necessarily within the package specified above.- Parameters:
preferences
- the preferences to use- Returns:
- the preferences for a specific scenario
-
getFont
public Font getFont()
Get the font to use.- Returns:
- the font
-
getIcon
public String getIcon(Validation.Type type)
Get the icon for the specified type. Note the icon can be any string that can be rendered using the font returned bygetFont()
although it is recommended this be a Unicode glyph or emoji-style icon.- Parameters:
type
- the validation type to get- Returns:
- the specified icon or an empty String if type is
Validation.Type.NONE
or not recognized
-
getColor
public Color getColor(Validation.Type type)
Get the icon for the specified type.- Parameters:
type
- the validation type to get- Returns:
- the specified color or
SystemColor.textText
if type isValidation.Type.NONE
or not recognized
-
-