use of com.codename1.ui.ComboBox in project CodenameOne by codenameone.
the class DefaultLookAndFeel method refreshTheme.
/**
* {@inheritDoc}
*/
public void refreshTheme(boolean b) {
chkBoxImages = null;
comboImage = null;
rButtonImages = null;
chkBoxImagesFocus = null;
rButtonImagesFocus = null;
super.refreshTheme(b);
UIManager m = getUIManager();
Image combo = m.getThemeImageConstant("comboImage");
if (combo != null) {
setComboBoxImage(combo);
} else {
if (Font.isNativeFontSchemeSupported()) {
Style c = UIManager.getInstance().createStyle("ComboBox.", "", false);
combo = FontImage.createMaterial(FontImage.MATERIAL_ARROW_DROP_DOWN, c);
setComboBoxImage(combo);
}
}
updateCheckBoxConstants(m, false, "");
updateCheckBoxConstants(m, true, "Focus");
updateRadioButtonConstants(m, false, "");
updateRadioButtonConstants(m, true, "Focus");
}
use of com.codename1.ui.ComboBox in project CodenameOne by codenameone.
the class HTMLForm method reset.
/**
* Called when a form reset is needed and resets all the form fields to their default values.
*/
void reset() {
for (Enumeration e = defaultValues.keys(); e.hasMoreElements(); ) {
Object input = e.nextElement();
if (input instanceof TextArea) {
// catches both textareas and text input fields
String defVal = (String) defaultValues.get(input);
if (defVal == null) {
defVal = "";
}
((TextArea) input).setText(defVal);
} else if (input instanceof ComboBox) {
OptionItem defVal = (OptionItem) defaultValues.get(input);
ComboBox combo = ((ComboBox) input);
if (defVal != null) {
combo.setSelectedItem(defVal);
} else if (combo.size() > 0) {
combo.setSelectedIndex(0);
}
}
}
for (Enumeration e = defaultCheckedButtons.elements(); e.hasMoreElements(); ) {
Button b = (Button) e.nextElement();
if (!b.isSelected()) {
setButton(b, true);
}
}
for (Enumeration e = defaultUncheckedButtons.elements(); e.hasMoreElements(); ) {
Button b = (Button) e.nextElement();
if (b.isSelected()) {
setButton(b, false);
}
}
}
use of com.codename1.ui.ComboBox in project CodenameOne by codenameone.
the class Calendar method setYearRange.
/**
* Sets the Calendar min and max years
*
* @param minYear the min year
* @param maxYear the max year
*/
public void setYearRange(int minYear, int maxYear) {
if (minYear > maxYear) {
throw new IllegalArgumentException("Max year should be bigger than or equal to min year!");
}
// The year combobox may not exist in the current context
if (year != null) {
Object previouslySelectedYear = year.getSelectedItem();
Vector years = new Vector();
for (int i = maxYear; i >= minYear; i--) {
years.addElement("" + i);
}
ListModel yearModel = new DefaultListModel(years);
year.setModel(yearModel);
if (years.contains(previouslySelectedYear)) {
year.setSelectedItem(previouslySelectedYear);
}
}
}
Aggregations