Java JComboBox Value createComboBox(ActionListener actionListener, Vector values, String command)

Here you can find the source of createComboBox(ActionListener actionListener, Vector values, String command)

Description

create Combo Box

License

Open Source License

Declaration

public static JComboBox createComboBox(ActionListener actionListener, Vector<?> values, String command) 

Method Source Code

//package com.java2s;
/*/*  w ww  .  j  ava  2  s  . c o m*/
 * ActionUtilities.java
 *
 * Copyright (C) 2002-2015 Takis Diakoumis
 *
 * 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; either version 3
 * of the License, or any later version.
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 */

import java.awt.event.ActionListener;
import java.util.Vector;

import javax.swing.JComboBox;

public class Main {
    public static JComboBox createComboBox(ActionListener actionListener, String[] values, String command) {
        JComboBox combo = new JComboBox(values);
        combo.setActionCommand(command);

        if (actionListener != null) {
            combo.addActionListener(actionListener);
        }

        return combo;
    }

    public static JComboBox createComboBox(String[] values, String command) {
        return createComboBox(null, values, command);
    }

    public static JComboBox createComboBox(ActionListener actionListener, Vector<?> values, String command) {
        JComboBox combo = new JComboBox(values);
        combo.setActionCommand(command);

        if (actionListener != null) {
            combo.addActionListener(actionListener);
        }

        return combo;
    }

    public static JComboBox createComboBox(Vector<?> values, String command) {
        return createComboBox(null, values, command);
    }
}

Related

  1. containsValue(JComboBox comboBox, String value)
  2. createComboBox(final Preferences node, final String pref_name, final String[] options, final String default_value)
  3. createStandardCombo(String[] values)
  4. fillValue(Vector vtData, int iComboIndex, int iVectorIndex, JComboBox cbo, Vector vt, boolean bClear, boolean bHaveNull)
  5. getCmbValue(JComboBox cmb)