Java JComboBox loadEnum(JComboBox combo, Class c, boolean removeAll)

Here you can find the source of loadEnum(JComboBox combo, Class c, boolean removeAll)

Description

load Enum

License

Open Source License

Declaration

public static <E extends Enum<E>> void loadEnum(JComboBox combo, Class<E> c, boolean removeAll) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JComboBox;

public class Main {
    public static <E extends Enum<E>> void loadEnum(JComboBox combo, Class<E> c) {
        loadEnum(combo, c, true);//  w  ww . jav a2  s.  c om
    }

    public static <E extends Enum<E>> void loadEnum(JComboBox combo, Class<E> c, boolean removeAll) {
        if (removeAll) {
            combo.removeAllItems();
        }

        for (E e : c.getEnumConstants()) {
            combo.addItem(e);
        }
    }
}

Related

  1. isComboBoxButton(AbstractButton button)
  2. isEmptyStr(javax.swing.JComboBox input)
  3. isJComboBoxNotEmpty(javax.swing.JComboBox combo)
  4. largeThan(javax.swing.JComboBox input, double x)
  5. loadComboBox(JComboBox combo, List list)
  6. loadPrefs(Preferences prefs, String prefKey, JComboBox combo)
  7. makeJComboBox(ResourceBundle resource, String panelName, String keyword)
  8. makeSquare(JComboBox... comboBoxes)
  9. newCombo(int chars)