Package com.jgoodies.forms.util
Class FormUtils
- java.lang.Object
-
- com.jgoodies.forms.util.FormUtils
-
public final class FormUtils extends java.lang.ObjectA library-internal class that consists only of static utility methods. Note: This class is not part of the public Forms API. It's intended for library implementation purposes only. The class's API may change at any time.- Since:
- 1.2
- Version:
- $Revision: 1.11 $
- Author:
- Karsten Lentzsch
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertNotBlank(java.lang.String text, java.lang.String description)Throws an exception if the specified text is blank using the given text description.static voidassertNotNull(java.lang.Object object, java.lang.String description)Throws an NPE if the given object isnullthat uses the specified text to describe the object.static voidclearLookAndFeelBasedCaches()Clears cached internal Forms state that is based on the Look&Feel, for example dialog base units.static booleanequals(java.lang.Object o1, java.lang.Object o2)Checks and answers if the two objects are bothnullor equal.static booleanisBlank(java.lang.String str)Checks and answers if the given string is whitespace, empty (""), ornull.static booleanisLafAqua()Lazily checks and answers whether the Aqua look&feel is active.static booleanisNotBlank(java.lang.String str)Checks and answers if the given string is not empty (""), notnulland not whitespace only.
-
-
-
Method Detail
-
assertNotBlank
public static void assertNotBlank(java.lang.String text, java.lang.String description)Throws an exception if the specified text is blank using the given text description.- Parameters:
text- the text to checkdescription- describes the text, used in the exception message- Throws:
java.lang.NullPointerException- iftextisnulljava.lang.IllegalArgumentException- iftextis empty, or blank
-
assertNotNull
public static void assertNotNull(java.lang.Object object, java.lang.String description)Throws an NPE if the given object isnullthat uses the specified text to describe the object.- Parameters:
object- the text to checkdescription- describes the object, used in the exception message- Throws:
java.lang.NullPointerException- ifobjectisnull
-
equals
public static boolean equals(java.lang.Object o1, java.lang.Object o2)Checks and answers if the two objects are bothnullor equal.#equals(null, null) == true #equals("Hi", "Hi") == true #equals("Hi", null) == false #equals(null, "Hi") == false #equals("Hi", "Ho") == false- Parameters:
o1- the first object to compareo2- the second object to compare- Returns:
- boolean
trueif and only if both objects arenullor equal
-
isBlank
public static boolean isBlank(java.lang.String str)
Checks and answers if the given string is whitespace, empty (""), ornull.FormUtils.isBlank(null) == true FormUtils.isBlank("") == true FormUtils.isBlank(" ") == true FormUtils.isBlank(" abc") == false FormUtils.isBlank("abc ") == false FormUtils.isBlank(" abc ") == false- Parameters:
str- the string to check, may benull- Returns:
trueif the string is whitespace, empty, ornull
-
isNotBlank
public static boolean isNotBlank(java.lang.String str)
Checks and answers if the given string is not empty (""), notnulland not whitespace only.FormUtils.isNotBlank(null) == false FormUtils.isNotBlank("") == false FormUtils.isNotBlank(" ") == false FormUtils.isNotBlank(" abc") == true FormUtils.isNotBlank("abc ") == true FormUtils.isNotBlank(" abc ") == true- Parameters:
str- the string to check, may benull- Returns:
trueif the string is not empty and notnulland not whitespace only
-
isLafAqua
public static boolean isLafAqua()
Lazily checks and answers whether the Aqua look&feel is active.- Returns:
trueif the current look&feel is Aqua
-
clearLookAndFeelBasedCaches
public static void clearLookAndFeelBasedCaches()
Clears cached internal Forms state that is based on the Look&Feel, for example dialog base units.There's typically no need to call this method directly. It'll be invoked automatically, if the L&F has been changed via
UIManager.setLookAndFeel(javax.swing.LookAndFeel)and cached data is requested. It's been made public to allow cache invalidation for cases where the L&F is changed temporarily by replacing the UIDefaults, for example in a visual editor.- Since:
- 1.2.1
-
-