public TimePanel(CronExpression date) { super(null); int sh = 25; lbl_type.setSize(100, sh); lbl_year.setSize(80, sh); lbl_month.setSize(80, sh); lbl_day_of_month.setSize(60, sh); // lbl_week_of_year .setSize(60, sh); lbl_week_of_month.setSize(60, sh); lbl_day_of_week.setSize(80, sh); lbl_hour.setSize(60, sh); lbl_minute.setSize(60, sh); lbl_second.setSize(60, sh); cells = new Component[][] { {lbl_type, combo_type, null}, {lbl_year, combo_year, every_year}, {lbl_month, combo_month, every_month}, {lbl_day_of_month, combo_day_of_month, every_day_of_month}, // {lbl_week_of_year, combo_week_of_year ,every_week_of_year }, {lbl_week_of_month, combo_week_of_month, every_week_of_month}, {lbl_day_of_week, combo_day_of_week, every_day_of_week}, {lbl_hour, combo_hour, every_hour}, {lbl_minute, combo_minute, every_minute}, {lbl_second, combo_second, every_second}, }; combo_year.setModel(new SpinnerNumberModel(1900, 1900, Short.MAX_VALUE, 1)); combo_day_of_month.setModel(new SpinnerNumberModel(1, 1, 31, 1)); // combo_week_of_year .setModel(new SpinnerNumberModel(1, 1, 54, 1)); combo_week_of_month.setModel(new SpinnerNumberModel(1, 1, 5, 1)); combo_hour.setModel(new SpinnerNumberModel(0, 0, 23, 1)); combo_minute.setModel(new SpinnerNumberModel(0, 0, 59, 1)); combo_second.setModel(new SpinnerNumberModel(0, 0, 59, 1)); combo_type.setSelectedItem(date.type); combo_type.addItemListener(this); layoutChilds(); // set default value try { MonthOfYear moy = EnumManager.getEnum(MonthOfYear.class, date.month.getKey()); DayOfWeek dow = EnumManager.getEnum(DayOfWeek.class, date.day_of_week.getKey()); combo_year.setValue(date.year.getKey()); combo_month.setValue(moy); combo_day_of_month.setValue(date.day_of_month.getKey()); // combo_week_of_year .setValue(date.week_of_year.getKey()); combo_week_of_month.setValue(date.week_of_month.getKey()); combo_day_of_week.setValue(dow); combo_hour.setValue(date.hour.getKey()); combo_minute.setValue(date.minute.getKey()); combo_second.setValue(date.second.getKey()); every_year.setSelected(date.year.getValue()); every_month.setSelected(date.month.getValue()); every_day_of_month.setSelected(date.day_of_month.getValue()); // every_week_of_year .setSelected(date.week_of_year.getValue()); every_week_of_month.setSelected(date.week_of_month.getValue()); every_day_of_week.setSelected(date.day_of_week.getValue()); every_hour.setSelected(date.hour.getValue()); every_minute.setSelected(date.minute.getValue()); every_second.setSelected(date.second.getValue()); for (int c = 0; c < cells.length; c++) { if (c > 0) { JCheckBox check = ((JCheckBox) cells[c][2]); cells[c][1].setEnabled(!check.isSelected()); } } if (every_day_of_week.isSelected()) { every_week_of_month.setVisible(!every_day_of_week.isSelected()); combo_week_of_month.setVisible(!every_day_of_week.isSelected()); repaint(); } } catch (Exception err) { err.printStackTrace(); } }