at.tuwien.ifs.somtoolbox.util
Class UiUtils

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

public class UiUtils
extends java.lang.Object

This class provides utility methods for User-Interfaces.

Version:
$Id: UiUtils.java 4144 2011-02-09 16:45:50Z mayer $
Author:
Rudolf Mayer

Constructor Summary
UiUtils()
           
 
Method Summary
static void centerWindow(java.awt.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 javax.swing.JButton createBrowseButton(javax.swing.JTextField txtInput, java.awt.Window parent, boolean directoryBrowser)
           
static javax.swing.JPanel fillPanel(javax.swing.JPanel panel, java.awt.Component... components)
           
static javax.swing.ImageIcon getIcon(java.lang.String imageName)
           
static javax.swing.ImageIcon getIcon(java.lang.String path, java.lang.String imageName)
           
static java.awt.Dimension getMaxUsableScreenSize()
           
static javax.swing.JPanel makeAndFillPanel(java.awt.Component... components)
           
static javax.swing.JPanel makeBorderedPanel(java.awt.LayoutManager layout, java.lang.String borderTitle)
           
static javax.swing.JPanel makeBorderedPanel(java.lang.String borderTitle)
           
static javax.swing.JLabel makeLabelWithTooltip(java.lang.String labelText, java.lang.String tooltipText)
           
static javax.swing.JRadioButton makeRadioButton(java.lang.String text, javax.swing.ButtonGroup buttonGroup)
           
static javax.swing.JRadioButton makeRadioButton(java.lang.String text, javax.swing.ButtonGroup buttonGroup, boolean selected)
           
static javax.swing.JRadioButton makeRadioButton(java.lang.String text, java.lang.String actionCommand, javax.swing.ButtonGroup buttonGroup, boolean selected)
           
static void packColumn(javax.swing.JTable table, int vColIndex, int margin)
          Sets the preferred width of the visible column specified by vColIndex.
static void packColumns(javax.swing.JTable table, int margin)
          Sets the preferred width of all visible columns, using packColumn(JTable, int, int)
static void recursiveAddBorderToPanel(javax.swing.JComponent c)
           
static void reSizeColumn(javax.swing.table.TableColumn col, int min, int preferred, int max)
           
static java.awt.Font scaleFont(java.awt.Component comp, double scale)
           
static java.awt.Font scaleFont(java.awt.Font font, double scale)
           
static double scaleLineWidth(double depth, double max, double min)
           
static void setSOMToolboxLookAndFeel()
           
static javax.swing.AbstractButton setToolbarButtonDetails(javax.swing.AbstractButton button, java.awt.event.ActionListener listener, java.lang.String imageName, java.lang.String toolTipText, java.lang.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(java.awt.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(javax.swing.JComponent c)

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String imageName)

getIcon

public static javax.swing.ImageIcon getIcon(java.lang.String path,
                                            java.lang.String imageName)

makeLabelWithTooltip

public static javax.swing.JLabel makeLabelWithTooltip(java.lang.String labelText,
                                                      java.lang.String tooltipText)

makeAndFillPanel

public static javax.swing.JPanel makeAndFillPanel(java.awt.Component... components)

fillPanel

public static javax.swing.JPanel fillPanel(javax.swing.JPanel panel,
                                           java.awt.Component... components)

setToolbarButtonDetails

public static javax.swing.AbstractButton setToolbarButtonDetails(javax.swing.AbstractButton button,
                                                                 java.awt.event.ActionListener listener,
                                                                 java.lang.String imageName,
                                                                 java.lang.String toolTipText,
                                                                 java.lang.String altText,
                                                                 boolean isSelected)

makeRadioButton

public static javax.swing.JRadioButton makeRadioButton(java.lang.String text,
                                                       javax.swing.ButtonGroup buttonGroup)

makeRadioButton

public static javax.swing.JRadioButton makeRadioButton(java.lang.String text,
                                                       javax.swing.ButtonGroup buttonGroup,
                                                       boolean selected)

makeRadioButton

public static javax.swing.JRadioButton makeRadioButton(java.lang.String text,
                                                       java.lang.String actionCommand,
                                                       javax.swing.ButtonGroup buttonGroup,
                                                       boolean selected)

makeBorderedPanel

public static javax.swing.JPanel makeBorderedPanel(java.lang.String borderTitle)

makeBorderedPanel

public static javax.swing.JPanel makeBorderedPanel(java.awt.LayoutManager layout,
                                                   java.lang.String borderTitle)

scaleFont

public static java.awt.Font scaleFont(java.awt.Component comp,
                                      double scale)

scaleFont

public static java.awt.Font scaleFont(java.awt.Font font,
                                      double scale)

packColumns

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


packColumn

public static void packColumn(javax.swing.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(javax.swing.table.TableColumn col,
                                int min,
                                int preferred,
                                int max)

getMaxUsableScreenSize

public static java.awt.Dimension getMaxUsableScreenSize()

createBrowseButton

public static javax.swing.JButton createBrowseButton(javax.swing.JTextField txtInput,
                                                     java.awt.Window parent,
                                                     boolean directoryBrowser)

scaleLineWidth

public static double scaleLineWidth(double depth,
                                    double max,
                                    double min)