/** * Changes the contents of the year selection JComboBox to reflect the * chosen date and the year range. */ private void refreshYearSelector() { if (!this.refreshing) { this.refreshing = true; this.yearSelector.removeAllItems(); final Integer[] years = getYears(this.chosenDate.get( Calendar.YEAR)); for (int i = 0; i < years.length; i++) { this.yearSelector.addItem(years[i]); } this.yearSelector.setSelectedItem(new Integer(this.chosenDate.get( Calendar.YEAR))); this.refreshing = false; } }
/** * Changes the contents of the year selection JComboBox to reflect the * chosen date and the year range. */ private void refreshYearSelector() { if (!this.refreshing) { this.refreshing = true; this.yearSelector.removeAllItems(); final Integer[] years = getYears(this.chosenDate.get( Calendar.YEAR)); for (int i = 0; i < years.length; i++) { this.yearSelector.addItem(years[i]); } this.yearSelector.setSelectedItem(new Integer(this.chosenDate.get( Calendar.YEAR))); this.refreshing = false; } }
/** * Changes the contents of the year selection JComboBox to reflect the * chosen date and the year range. */ private void refreshYearSelector() { if (!this.refreshing) { this.refreshing = true; this.yearSelector.removeAllItems(); final Integer[] years = getYears(this.chosenDate.get( Calendar.YEAR)); for (int i = 0; i < years.length; i++) { this.yearSelector.addItem(years[i]); } this.yearSelector.setSelectedItem(new Integer(this.chosenDate.get( Calendar.YEAR))); this.refreshing = false; } }
/** * Constructs a panel containing two JComboBoxes (for the month and year) * and a button (to reset the date to TODAY). * * @return the panel. */ private JPanel constructSelectionPanel() { final JPanel p = new JPanel(); final int minMonth = this.chosenDate.getMinimum(Calendar.MONTH); final int maxMonth = this.chosenDate.getMaximum(Calendar.MONTH); final String[] months = new String[maxMonth - minMonth + 1]; System.arraycopy(SerialDate.getMonths(), minMonth, months, 0, months.length); this.monthSelector = new JComboBox(months); this.monthSelector.addActionListener(this); this.monthSelector.setActionCommand("monthSelectionChanged"); p.add(this.monthSelector); this.yearSelector = new JComboBox(getYears(0)); this.yearSelector.addActionListener(this); this.yearSelector.setActionCommand("yearSelectionChanged"); p.add(this.yearSelector); return p; }
/** * Constructs a panel containing two JComboBoxes (for the month and year) * and a button (to reset the date to TODAY). * * @return the panel. */ private JPanel constructSelectionPanel() { final JPanel p = new JPanel(); final int minMonth = this.chosenDate.getMinimum(Calendar.MONTH); final int maxMonth = this.chosenDate.getMaximum(Calendar.MONTH); final String[] months = new String[maxMonth - minMonth + 1]; System.arraycopy(SerialDate.getMonths(), minMonth, months, 0, months.length); this.monthSelector = new JComboBox(months); this.monthSelector.addActionListener(this); this.monthSelector.setActionCommand("monthSelectionChanged"); p.add(this.monthSelector); this.yearSelector = new JComboBox(getYears(0)); this.yearSelector.addActionListener(this); this.yearSelector.setActionCommand("yearSelectionChanged"); p.add(this.yearSelector); return p; }
/** * Constructs a panel containing two JComboBoxes (for the month and year) * and a button (to reset the date to TODAY). * * @return the panel. */ private JPanel constructSelectionPanel() { final JPanel p = new JPanel(); final int minMonth = this.chosenDate.getMinimum(Calendar.MONTH); final int maxMonth = this.chosenDate.getMaximum(Calendar.MONTH); final String[] months = new String[maxMonth - minMonth + 1]; System.arraycopy(SerialDate.getMonths(), minMonth, months, 0, months.length); this.monthSelector = new JComboBox(months); this.monthSelector.addActionListener(this); this.monthSelector.setActionCommand("monthSelectionChanged"); p.add(this.monthSelector); this.yearSelector = new JComboBox(getYears(0)); this.yearSelector.addActionListener(this); this.yearSelector.setActionCommand("yearSelectionChanged"); p.add(this.yearSelector); return p; }