at.tuwien.ifs.somtoolbox.util
Class UiUtils

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.util.UiUtils

public class UiUtils
extends Object

This class provides utility methods for User-Interfaces.

Version:
$Id: UiUtils.java 3863 2010-10-20 16:25:06Z mayer $
Author:
Rudolf Mayer

Constructor Summary
UiUtils()
           
 
Method Summary
static void centerWindow(Component window)
          Places the given component in the middle of the screen.
Actually intended for JFrame and JDialog, but Component is superclass of both.
static JButton createBrowseButton(JTextField txtInput, Window parent, boolean directoryBrowser)
           
static JPanel fillPanel(JPanel panel, Component... components)
           
static ImageIcon getIcon(String imageName)
           
static ImageIcon getIcon(String path, String imageName)
           
static Dimension getMaxUsableScreenSize()
           
static JPanel makeAndFillPanel(Component... components)
           
static JPanel makeBorderedPanel(LayoutManager layout, String borderTitle)
           
static JPanel makeBorderedPanel(String borderTitle)
           
static JLabel makeLabelWithTooltip(String labelText, String tooltipText)
           
static JRadioButton makeRadioButton(String text, ButtonGroup buttonGroup)
           
static JRadioButton makeRadioButton(String text, ButtonGroup buttonGroup, boolean selected)
           
static JRadioButton makeRadioButton(String text, String actionCommand, ButtonGroup buttonGroup, boolean selected)
           
static void packColumn(JTable table, int vColIndex, int margin)
          Sets the preferred width of the visible column specified by vColIndex.
static void packColumns(JTable table, int margin)
          Sets the preferred width of all visible columns, using packColumn(JTable, int, int)
static void recursiveAddBorderToPanel(JComponent c)
           
static void reSizeColumn(TableColumn col, int min, int preferred, int max)
           
static Font scaleFont(Component comp, double scale)
           
static Font scaleFont(Font font, double scale)
           
static void setSOMToolboxLookAndFeel()
           
static AbstractButton setToolbarButtonDetails(AbstractButton button, ActionListener listener, String imageName, String toolTipText, String altText, boolean isSelected)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UiUtils

public UiUtils()
Method Detail

centerWindow

public static void centerWindow(Component window)
Places the given component in the middle of the screen.
Actually intended for JFrame and JDialog, but Component is superclass of both.


setSOMToolboxLookAndFeel

public static void setSOMToolboxLookAndFeel()

recursiveAddBorderToPanel

public static void recursiveAddBorderToPanel(JComponent c)

getIcon

public static ImageIcon getIcon(String imageName)

getIcon

public static ImageIcon getIcon(String path,
                                String imageName)

makeLabelWithTooltip

public static JLabel makeLabelWithTooltip(String labelText,
                                          String tooltipText)

makeAndFillPanel

public static JPanel makeAndFillPanel(Component... components)

fillPanel

public static JPanel fillPanel(JPanel panel,
                               Component... components)

setToolbarButtonDetails

public static AbstractButton setToolbarButtonDetails(AbstractButton button,
                                                     ActionListener listener,
                                                     String imageName,
                                                     String toolTipText,
                                                     String altText,
                                                     boolean isSelected)

makeRadioButton

public static JRadioButton makeRadioButton(String text,
                                           ButtonGroup buttonGroup)

makeRadioButton

public static JRadioButton makeRadioButton(String text,
                                           ButtonGroup buttonGroup,
                                           boolean selected)

makeRadioButton

public static JRadioButton makeRadioButton(String text,
                                           String actionCommand,
                                           ButtonGroup buttonGroup,
                                           boolean selected)

makeBorderedPanel

public static JPanel makeBorderedPanel(String borderTitle)

makeBorderedPanel

public static JPanel makeBorderedPanel(LayoutManager layout,
                                       String borderTitle)

scaleFont

public static Font scaleFont(Component comp,
                             double scale)

scaleFont

public static Font scaleFont(Font font,
                             double scale)

packColumns

public static void packColumns(JTable table,
                               int margin)
Sets the preferred width of all visible columns, using packColumn(JTable, int, int)


packColumn

public static void packColumn(JTable table,
                              int vColIndex,
                              int margin)
Sets the preferred width of the visible column specified by vColIndex. The column will be just wide enough to show the column head and the widest cell in the column. Margin pixels are added to the left and right (resulting in an additional width of 2*margin pixels).


reSizeColumn

public static void reSizeColumn(TableColumn col,
                                int min,
                                int preferred,
                                int max)

getMaxUsableScreenSize

public static Dimension getMaxUsableScreenSize()

createBrowseButton

public static JButton createBrowseButton(JTextField txtInput,
                                         Window parent,
                                         boolean directoryBrowser)