org.brains2b.util
Class GuiHelper

java.lang.Object
  extended byorg.brains2b.util.GuiHelper

public class GuiHelper
extends java.lang.Object

Static help function for GUI related items

Version:
1.10.1 [03-10-2007]
Author:
Dennis Groenendijk

Method Summary
static java.awt.Dimension decodeDimension(java.lang.String dim)
           
static java.lang.String encodeDimension(java.awt.Dimension d)
           
static int getWidth(java.lang.String str)
          Calculates Width in pixels on the basis of String The default font from a Swing component is used get the necessary metrics.
static int getWidth(java.lang.String str, int width)
          Calculates the width in pixels of a given string and return the longer of the string length or the given width.
static boolean isColor(java.lang.String value)
          check if a value supplied as a String contains the information to be used as a Color
static boolean isFont(java.lang.String value)
          check if a value supplied as a String contains the information to be used as a Font
static java.awt.Rectangle setMiddle(java.awt.Rectangle target, java.awt.Rectangle source)
          Calculates Middle for a target from a source
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setMiddle

public static java.awt.Rectangle setMiddle(java.awt.Rectangle target,
                                           java.awt.Rectangle source)
Calculates Middle for a target from a source

Parameters:
target - java.awt.Rectangle
source - java.awt.Rectangle
Returns:
java.awt.Rectangle
Throws:
java.lang.IllegalArgumentException - if either source or target is null

decodeDimension

public static final java.awt.Dimension decodeDimension(java.lang.String dim)

encodeDimension

public static final java.lang.String encodeDimension(java.awt.Dimension d)

getWidth

public static int getWidth(java.lang.String str)
Calculates Width in pixels on the basis of String The default font from a Swing component is used get the necessary metrics.

Parameters:
str - String

getWidth

public static int getWidth(java.lang.String str,
                           int width)
Calculates the width in pixels of a given string and return the longer of the string length or the given width.

Parameters:
str - String

isColor

public static boolean isColor(java.lang.String value)
check if a value supplied as a String contains the information to be used as a Color

Parameters:
value - String, the value to be used as Color
Returns:
true if the value can be used as a color, false otherwise
Since:
TwelBox 0.33

isFont

public static boolean isFont(java.lang.String value)
check if a value supplied as a String contains the information to be used as a Font

Parameters:
value - String, the value to be used as Font
Returns:
true if the value can be used as a Font, false otherwise
Since:
TwelBox 0.33