info.joseluismartin.gui.form
Class FormUtils

java.lang.Object
  extended by info.joseluismartin.gui.form.FormUtils

public abstract class FormUtils
extends Object

Static utility library for use in Swing Forms

Author:
Jose Luis Martin - (jlm@joseluismartin.info)

Constructor Summary
FormUtils()
           
 
Method Summary
static Border createTitledBorder(String name)
          Create Titled Border
static List<Object> getComboModelList(ComboBoxModel model)
          Return a List of Objects from a ComboBoxModel
static Icon getIcon(Icon icon, String url)
          Load icon if icon = null, else return icon.
static Icon getIcon(String url)
          Load Icon from url
static void link(JComboBox primary, JComboBox dependent, String propertyName)
           
static void link(JComboBox primary, JComboBox dependent, String propertyName, boolean addNull)
          Add a link on primary and dependent JComboBoxes by property name.
static JButton newCancelButton()
          Get Default OK Button from LookAndFeel (like JOptionPane)
static JComboBox newCombo(int chars)
           
static JButton newOKButton()
          Get Default OK Button from LookAndFeel (like JOptionPane)
static void setBold(JLabel label)
          Make font of JLabel bold
static JMenu toMenu(List<Action> actions)
          Make a JMenu from an Action List
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormUtils

public FormUtils()
Method Detail

link

public static void link(JComboBox primary,
                        JComboBox dependent,
                        String propertyName)

link

public static void link(JComboBox primary,
                        JComboBox dependent,
                        String propertyName,
                        boolean addNull)
Add a link on primary and dependent JComboBoxes by property name. When selection changes on primary use propertyName to get a Collection and fill dependent JComboBox with it

Parameters:
primary - JComboBox when selection changes
dependent - JComboBox that are filled with collection
propertyName - the property name for get the collection from primary selected item
addNull - if true, add a null as first combobox item

getComboModelList

public static List<Object> getComboModelList(ComboBoxModel model)
Return a List of Objects from a ComboBoxModel

Parameters:
model - ComboBoxModel
Returns:
a list of Objects with ComboBoxModel items

newCombo

public static JComboBox newCombo(int chars)

setBold

public static void setBold(JLabel label)
Make font of JLabel bold

Parameters:
label - JLabel to make bold

createTitledBorder

public static Border createTitledBorder(String name)
Create Titled Border

Parameters:
name - the title
Returns:
Border

newOKButton

public static JButton newOKButton()
Get Default OK Button from LookAndFeel (like JOptionPane)


newCancelButton

public static JButton newCancelButton()
Get Default OK Button from LookAndFeel (like JOptionPane)


getIcon

public static Icon getIcon(String url)
Load Icon from url

Parameters:
url -
Returns:
Icon, null on faliure

getIcon

public static Icon getIcon(Icon icon,
                           String url)
Load icon if icon = null, else return icon.

Parameters:
icon - icon to load
url - String with url
Returns:
icon

toMenu

public static JMenu toMenu(List<Action> actions)
Make a JMenu from an Action List

Parameters:
actions - the Action List
Returns:
JMenu


Copyright © 2012 JDAL. All Rights Reserved.