private boolean correspondsToCheckBoxes(JCheckBox[] checkBoxes, Object object) { if (object instanceof Calendar || object == null) { SimpleDateFormat calendarFormatter = new SimpleDateFormat("dd.MM.yyyy"); String calendarStr = (object != null) ? calendarFormatter.format(((Calendar) object).getTime()) : ""; for (JCheckBox checkBox : checkBoxes) { if (checkBox.isSelected() && calendarStr.matches(checkBox.getActionCommand())) { return true; } } } return false; }