Java highlighting specific dates in JCalendar cell
I followed the codes here to set the colors of a specific date in Toedter's Calendar . The problem I am facing now is that it is not highlighting the correct cell. In my example I have used 14th and 15th of June but it highlighted 8th and 9th. And heres my code: DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Date sdate= null; String d = null; for(int i =0;i<pd.size();i++){ d = pd.get(i).getDate(); try{ sdate = (Date)formatter.parse(d); if(events.contains(sdate)){ } else{ events.add(sdate); System.out.println(sdate); } }catch(ParseException r){ System.out.println("error"); } } /