Here you can find the source of makeJComboBox(ResourceBundle resource, String panelName, String keyword)
public static JComboBox<String> makeJComboBox(ResourceBundle resource, String panelName, String keyword)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.util.MissingResourceException; import java.util.ResourceBundle; import javax.swing.JComboBox; public class Main { public static JComboBox<String> makeJComboBox(ResourceBundle resource, String panelName, String keyword) { String value = null;/*from ww w . j av a2 s . c o m*/ try { value = resource.getString(panelName + "_COMBOBOX_" + keyword + "_DEFAULT"); } catch (MissingResourceException e) { } JComboBox<String> jcb = new JComboBox<>(); String val = null; int ii = 0; do { try { val = resource.getString(panelName + "_COMBOBOX_" + keyword + "_VALUE_" + ii); if (val != null) { jcb.addItem(val); } ++ii; } catch (MissingResourceException e) { val = null; } } while (val != null); if (value != null) jcb.setSelectedItem(value); return jcb; } }