net.luniks.swing
Class Utils

java.lang.Object
  extended bynet.luniks.swing.Utils

public class Utils
extends java.lang.Object

Class with some swing-related static utility methods

Author:
Torsten Römer, www.luniks.net

Constructor Summary
Utils()
           
 
Method Summary
static java.util.List getAllItems(javax.swing.JComboBox comboBox)
          Returns an ArrayList containing all items in a ComboBox
static void populate(javax.swing.JComboBox comboBox, java.util.Collection collection)
          Populates the combobox given as first argument with the elements contained in the collection given as second argument.
static void populate(javax.swing.JComboBox comboBox, java.lang.Object[] list)
          Populates the combobox given as first argument with the elements contained in the array given as second argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utils

public Utils()
Method Detail

populate

public static void populate(javax.swing.JComboBox comboBox,
                            java.util.Collection collection)
Populates the combobox given as first argument with the elements contained in the collection given as second argument.

Parameters:
comboBox - the combobox to be populated
collection - the collection containing the elements

populate

public static void populate(javax.swing.JComboBox comboBox,
                            java.lang.Object[] list)
Populates the combobox given as first argument with the elements contained in the array given as second argument. If an element is null, a String representing the value index + 1 is added instead.

Parameters:
comboBox - the combobox to be populated
list - the array containing the elements

getAllItems

public static java.util.List getAllItems(javax.swing.JComboBox comboBox)
Returns an ArrayList containing all items in a ComboBox

Parameters:
comboBox - the combobox to get the items from
Returns:
ArrayList containing all items


Copyright (c) 2004, 2005 Torsten Römer, dode@luniks.net