pmp.gui
Class GUITools

java.lang.Object
  extended by pmp.gui.GUITools

public final class GUITools
extends java.lang.Object

Tools for GUI.

Title: Mail client

Description: Mail client

Copyright: Copyright (c) 2004, LH

Version:
1.0
Author:
Luděk Hlaváček

Field Summary
static java.lang.String ICON_ABOUT
           
static java.lang.String ICON_CLOSE
           
static java.lang.String ICON_EMPTY
          Empty icon.
static java.lang.String ICON_EXIT
           
static java.lang.String ICON_HELP
           
static java.lang.String ICON_LOADDEF
           
static java.lang.String ICON_LOADXML
           
static java.lang.String ICON_MACROS
           
static java.lang.String ICON_RUN
           
protected static java.util.Map<java.lang.String,javax.swing.ImageIcon> icons
          Cache for icons loaded from disk.
 
Method Summary
static void centreWindow(java.awt.Window frame)
          Sets window's position to screen centre.
static java.lang.String getComponentValue(javax.swing.JComponent editor)
          Tries to obtain String value from JComponent.
static javax.swing.ImageIcon getIcon(java.lang.String filename)
          Looks for icon in cache or loads image from file using loadIcon(String).
static javax.swing.filechooser.FileFilter getXmlFilter()
          Returns FileFilter for selecting XML files.
protected static javax.swing.ImageIcon loadIcon(java.lang.String filename)
          Loads image from file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_EMPTY

public static final java.lang.String ICON_EMPTY
Empty icon. Use as a replacement for nonexisting icons.

See Also:
Constant Field Values

ICON_CLOSE

public static final java.lang.String ICON_CLOSE
See Also:
Constant Field Values

ICON_EXIT

public static final java.lang.String ICON_EXIT
See Also:
Constant Field Values

ICON_MACROS

public static final java.lang.String ICON_MACROS
See Also:
Constant Field Values

ICON_LOADXML

public static final java.lang.String ICON_LOADXML
See Also:
Constant Field Values

ICON_LOADDEF

public static final java.lang.String ICON_LOADDEF
See Also:
Constant Field Values

ICON_ABOUT

public static final java.lang.String ICON_ABOUT
See Also:
Constant Field Values

ICON_RUN

public static final java.lang.String ICON_RUN
See Also:
Constant Field Values

ICON_HELP

public static final java.lang.String ICON_HELP
See Also:
Constant Field Values

icons

protected static java.util.Map<java.lang.String,javax.swing.ImageIcon> icons
Cache for icons loaded from disk.

Method Detail

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String filename)
Looks for icon in cache or loads image from file using loadIcon(String).

Parameters:
filename - name of PNG file without extension and path.
Returns:
loaded image or null.

loadIcon

protected static javax.swing.ImageIcon loadIcon(java.lang.String filename)
Loads image from file.

Parameters:
filename - name of PNG file without extension and path.
Returns:
loaded image or null.

centreWindow

public static void centreWindow(java.awt.Window frame)
Sets window's position to screen centre.

Parameters:
frame - window to move to the centre of screen

getXmlFilter

public static javax.swing.filechooser.FileFilter getXmlFilter()
Returns FileFilter for selecting XML files.


getComponentValue

public static java.lang.String getComponentValue(javax.swing.JComponent editor)
Tries to obtain String value from JComponent. If fails returns empty string "" (not null)

Parameters:
editor - given component
Returns:
obtained string