net.xoetrope.xui.helper
Class XuiUtilities

java.lang.Object
  extended by net.xoetrope.xui.helper.XuiUtilities

public class XuiUtilities
extends java.lang.Object

A collection of utilities for use with XUI

Copyright (c) Xoetrope Ltd., 2002-2004

$Revision: 2.16 $

License: see License.txt


Constructor Summary
XuiUtilities()
           
 
Method Summary
static void applyStyle(java.lang.Object comp, java.lang.String styleName)
          Apply a style to a component
static void centerOnScreen(java.awt.Container dialog)
          Center a dialog on the screen.
static int count(java.lang.String source, char match)
          Count the instances of a character in a string
static void getArguments(java.lang.String argString, java.lang.Class[] argTypes, java.lang.Object[] argValues)
          Get the argument types and values from an argument string
static int getMinorVersion()
          Get the minor version of the runtime Java platform
static void invokeAndWait(java.lang.Runnable r)
          Invoke the SwingUtilities invokeAndWait method via reflection.
static void invokeLater(java.lang.Runnable r)
          Invoke the SwingUtilities invokeLater method via reflection.
static java.lang.String translate(java.lang.String key)
          Translate a key to the current language
static java.awt.Color unsaturateColor(java.awt.Color color, int percentage)
          Get an unsaturated version of a color
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XuiUtilities

public XuiUtilities()
Method Detail

count

public static int count(java.lang.String source,
                        char match)
Count the instances of a character in a string

Parameters:
source - the source string
match - the character to match
Returns:
the numer of instances of the match character

centerOnScreen

public static void centerOnScreen(java.awt.Container dialog)
Center a dialog on the screen.

Parameters:
dialog - the dialog window you want to center

invokeLater

public static void invokeLater(java.lang.Runnable r)
Invoke the SwingUtilities invokeLater method via reflection.

Parameters:
r - the runnable to be passed to the SwingUtilities method

invokeAndWait

public static void invokeAndWait(java.lang.Runnable r)
Invoke the SwingUtilities invokeAndWait method via reflection.

Parameters:
r - the runnable to be passed to the SwingUtilities method

translate

public static java.lang.String translate(java.lang.String key)
Translate a key to the current language

Parameters:
key - the language key
Returns:
the translated text

unsaturateColor

public static java.awt.Color unsaturateColor(java.awt.Color color,
                                             int percentage)
Get an unsaturated version of a color

Parameters:
color - the original color
percentage - the percentage of the original color saturation to return

getArguments

public static void getArguments(java.lang.String argString,
                                java.lang.Class[] argTypes,
                                java.lang.Object[] argValues)
Get the argument types and values from an argument string

Parameters:
argString - the raw argument string e.g. foo,bar,12
argTypes - the argument class names - for the above example java.lang.String,java.lang.String,java.lang.int
argValues - the argument values - for the above example "foo", "bar", 12

applyStyle

public static void applyStyle(java.lang.Object comp,
                              java.lang.String styleName)
Apply a style to a component

Parameters:
comp - the component
styleName - the style to lookup

getMinorVersion

public static int getMinorVersion()
Get the minor version of the runtime Java platform

Returns:
the minor version e.g. 3 for JDK 1.3.x