File: MonthCombo.java

package info (click to toggle)
gpsprune 26.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,824 kB
  • sloc: java: 52,154; sh: 25; makefile: 21; python: 15
file content (30 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (4)
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();
	}
}