1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package tim.prune.function.filesleuth.gui;
import javax.swing.JComboBox;
import tim.prune.I18nManager;
public class MonthCombo extends JComboBox<String>
{
public MonthCombo() {
super(getItems());
}
private static String[] getItems()
{
String[] keys = new String[] {"all", "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"};
String[] items = new String[keys.length];
for (int i=0; i<keys.length; i++) {
items[i] = I18nManager.getText("dialog.editdaterange.month." + keys[i]);
}
return items;
}
public boolean isAllMonths() {
return getSelectedIndex() == 0;
}
public int getMonthNum() {
return isAllMonths() ? -1 : getSelectedIndex();
}
}
|