List of utility methods to do JComboBox
boolean | isEmptyStr(javax.swing.JComboBox input) Check if the JComboBox selection is empty String str = (String) input.getSelectedItem(); return str == null || "".equals(str.trim()); |
boolean | isJComboBoxNotEmpty(javax.swing.JComboBox is J Combo Box Not Empty return !((String) combo.getSelectedItem()).trim().isEmpty();
|
boolean | largeThan(javax.swing.JComboBox input, double x) Check if the JComboBox input is larger than x double d = new Double((String) (input.getSelectedItem())).doubleValue(); if (d > x) return true; return false; |
void | loadComboBox(JComboBox combo, List list) load Combo Box loadComboBox(combo, list, true); |
void | loadEnum(JComboBox combo, Class load Enum if (removeAll) { combo.removeAllItems(); for (E e : c.getEnumConstants()) { combo.addItem(e); |
void | loadPrefs(Preferences prefs, String prefKey, JComboBox combo) load Prefs DefaultComboBoxModel comboModel = new DefaultComboBoxModel(); String recents = prefs.get(prefKey, null); if (recents != null) { StringTokenizer st = new StringTokenizer(recents, DELIMITER); while (st.hasMoreTokens()) { comboModel.addElement(st.nextToken()); combo.setModel(comboModel); |
JComboBox | makeJComboBox(ResourceBundle resource, String panelName, String keyword) make J Combo Box String value = null; try { value = resource.getString(panelName + "_COMBOBOX_" + keyword + "_DEFAULT"); } catch (MissingResourceException e) { JComboBox<String> jcb = new JComboBox<>(); String val = null; int ii = 0; ... |
void | makeSquare(JComboBox>... comboBoxes) Sets the given combo boxes to appear in the square style. for (JComboBox<?> comboBox : comboBoxes) { comboBox.putClientProperty("JComboBox.isSquare", true); |
JComboBox> | newCombo(int chars) new Combo StringBuilder sb = new StringBuilder(chars); while (chars-- > 0) sb.append("X"); JComboBox<String> combo = new JComboBox<String>(); combo.setPrototypeDisplayValue(sb.toString()); return combo; |
void | prepareComboBox(JComboBox comboBox, Dimension size, int min, int max, int[] list) prepares comboBox control comboBox.setLayout(null); comboBox.setSize(size); comboBox.setFont(fontComboBox); comboBox.removeAllItems(); for (; min <= max; min++) { comboBox.addItem(min); if (list != null) { ... |