edu.ksu.cis.kdd.util.gui
Class GUIUtil

java.lang.Object
  extended byedu.ksu.cis.kdd.util.gui.GUIUtil

public class GUIUtil
extends java.lang.Object

Smorgasbord of GUI utilities

Author:
Roby Joehanes

Field Summary
protected static java.awt.BasicStroke defaultMarquee
           
protected static float[] defaultMarqueePattern
           
static java.awt.Dimension screenSize
           
 
Constructor Summary
GUIUtil()
           
 
Method Summary
static java.awt.Dimension center(java.awt.Dimension src, java.awt.Dimension dest)
          Center a dimension of src to dest
static void centerToComponent(java.awt.Component src, java.awt.Component dest)
          Component src is centered within component dest.
static void centerToScreen(java.awt.Component c)
          Center component c to the screen
static java.awt.Dimension centerToScreen(java.awt.Dimension src)
          Center a dimension src to the screen
static javax.swing.JComboBox createComboBox(java.util.Collection c)
           
static java.awt.BasicStroke createMarquee(float[] pattern)
           
static java.awt.BasicStroke createMarquee(float width, float[] pattern)
           
static java.awt.BasicStroke createMarquee(float width, float[] pattern, float offset)
           
static void gbAdd(java.awt.Container c, java.awt.Component comp, int x, int y, int w, int h, int up, int down, int left, int right, int fill, int anchor, double wx, double wy)
          Grid bag add
static java.awt.BasicStroke getDefaultMarquee()
           
static boolean isCenterMouseButton(java.awt.event.MouseEvent e)
           
static boolean isLeftMouseButton(java.awt.event.MouseEvent e)
           
static boolean isRightMouseButton(java.awt.event.MouseEvent e)
           
static javax.swing.LookAndFeel loadLookAndFeel(java.lang.String className)
           
static void loadTheme(java.lang.String themeFileName)
           
static void switchToNativeUI(java.awt.Component c)
          Switch component c's look and feel to native user interface
static void switchUI(java.lang.String laf)
           
static javax.swing.KeyStroke translateShortcut(java.lang.String shortcut)
          Translate a string shortcut to the respective keystroke object for Swing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

screenSize

public static java.awt.Dimension screenSize

defaultMarqueePattern

protected static float[] defaultMarqueePattern

defaultMarquee

protected static java.awt.BasicStroke defaultMarquee
Constructor Detail

GUIUtil

public GUIUtil()
Method Detail

switchToNativeUI

public static void switchToNativeUI(java.awt.Component c)
Switch component c's look and feel to native user interface

Parameters:
c -

switchUI

public static void switchUI(java.lang.String laf)

loadLookAndFeel

public static javax.swing.LookAndFeel loadLookAndFeel(java.lang.String className)
                                               throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException

loadTheme

public static void loadTheme(java.lang.String themeFileName)

center

public static java.awt.Dimension center(java.awt.Dimension src,
                                        java.awt.Dimension dest)
Center a dimension of src to dest

Parameters:
src -
dest -
Returns:

centerToScreen

public static java.awt.Dimension centerToScreen(java.awt.Dimension src)
Center a dimension src to the screen

Parameters:
src -
Returns:
The centered dimension

centerToScreen

public static void centerToScreen(java.awt.Component c)
Center component c to the screen

Parameters:
c -

centerToComponent

public static void centerToComponent(java.awt.Component src,
                                     java.awt.Component dest)
Component src is centered within component dest. If the src Component is larger than the dest Component centering is still performed just the dest component will be covered.

Parameters:
src -
dest -

gbAdd

public static void gbAdd(java.awt.Container c,
                         java.awt.Component comp,
                         int x,
                         int y,
                         int w,
                         int h,
                         int up,
                         int down,
                         int left,
                         int right,
                         int fill,
                         int anchor,
                         double wx,
                         double wy)
Grid bag add

Parameters:
c - Container
comp - Component to add to the container
x - X coordinate
y - Y coordinate
w - Width
h - Height
up - Up margin
down - Down margin
left - Left margin
right - Right margin
fill - Fill constants
anchor - Anchor constants
wx - Weight x
wy - Weight y

createComboBox

public static javax.swing.JComboBox createComboBox(java.util.Collection c)

isRightMouseButton

public static boolean isRightMouseButton(java.awt.event.MouseEvent e)

isLeftMouseButton

public static boolean isLeftMouseButton(java.awt.event.MouseEvent e)

isCenterMouseButton

public static boolean isCenterMouseButton(java.awt.event.MouseEvent e)

getDefaultMarquee

public static java.awt.BasicStroke getDefaultMarquee()

createMarquee

public static java.awt.BasicStroke createMarquee(float[] pattern)

createMarquee

public static java.awt.BasicStroke createMarquee(float width,
                                                 float[] pattern)

createMarquee

public static java.awt.BasicStroke createMarquee(float width,
                                                 float[] pattern,
                                                 float offset)

translateShortcut

public static javax.swing.KeyStroke translateShortcut(java.lang.String shortcut)
Translate a string shortcut to the respective keystroke object for Swing

Parameters:
shortcut -
Returns:
The keystroke