Here you can find the source of addToCombo(JComboBox combo, Iterator it)
JComboBox
instance.
Parameter | Description |
---|---|
combo | a <code>JComboBox</code> instance |
it | iterator to the contents to be added to the combo |
public static void addToCombo(JComboBox combo, Iterator it)
//package com.java2s; /*//w w w . j a v a 2 s . c o m This file is part of Coach Assistant Copyright (C) 2004-2006 Sina Iravanian <sina_iravanian@yahoo.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ import java.util.Iterator; import javax.swing.JComboBox; public class Main { /** * This method automatically adds the contents of a data structured refered * to by an iterator to a <code>JComboBox</code> instance. * * @param combo * a <code>JComboBox</code> instance * @param it * iterator to the contents to be added to the combo */ public static void addToCombo(JComboBox combo, Iterator it) { while (it.hasNext()) { combo.addItem(it.next()); } } }