jcalendar

Java highlighting specific dates in JCalendar cell

巧了我就是萌 提交于 2019-11-28 02:12:44
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"); } } /

Get the list of dates between two dates [closed]

寵の児 提交于 2019-11-27 16:13:12
I'm using JDateChooser and I'm making a program that output the list of dates between the selected dates. for example: date1= Jan 1, 2013 // Starting Date date2= Jan 16,2013 // End Date then it will output Jan 2, 2013... Jan 3, 2013.. Jan 4, 2013.. and so on... until it reaches the end date. I already finish working on the my program that once you click a date on the JDatechooser it will output the end date automatically. (selected date + 15 days = end dates) I download the JCalendar or JDateChooser here: http://www.toedter.com/en/jcalendar/ You should try using Calendar , which will allow you

How to disable or highlight the dates in JCalendar

◇◆丶佛笑我妖孽 提交于 2019-11-27 14:54:48
In my case i want to disable or highlight dates in Java calendar. I used JCalendar and DateChooserCombo and could not find a way to do it. Finally, I tried the below code and it also was not successful. For example: I want to disable all dates from 14-09-13 to 23-09-13 . DateFormat formatter = new SimpleDateFormat("yyyy-mm-dd"); try { Date d1 = formatter.parse("2013-09-14"); Date d2 = formatter.parse("2013-09-23"); jCalendar1.setSelectableDateRange(d1, d2); } catch (ParseException ex) { ex.printStackTrace(); } I know this has been inactive for a while but hopefully it can be useful to someone.

Add specific background colors to JDaychooser Dates

佐手、 提交于 2019-11-27 06:30:49
问题 I've developed a Java Swing application.. How can I set the background color of specific JDayChooser dates? Thanks 回答1: getDayPanel public javax.swing.JPanel getDayPanel() This returns the day panel. After that, you can: panel.setBackground(color); Also: setForeground public void setForeground(java.awt.Color foreground) Sets the foregroundColor color. setDecorationBackgroundColor public void setDecorationBackgroundColor(java.awt.Color decorationBackgroundColor) Sets the background of days and

Java highlighting specific dates in JCalendar cell

一笑奈何 提交于 2019-11-27 04:52:11
问题 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

Is it possible to detect a date change on a JCalendar JDateChooser field?

混江龙づ霸主 提交于 2019-11-27 01:30:31
I'd like to detect when the date is changed in a JDateChooser field so that I can update another field. Is this possible? And if so where should I be starting? I've already looked at the documentation and unfortunately there are no methods for adding something like an ActionListener or StateChangeListener (my first thoughts). com.toedter.calendar.JCalendar inherits a listenerList from JComponent and it implements java.beans.PropertyChangeListener . I'd add a listener and see what comes though. Edit: I think you can use addPropertyChangeListener() the same way JCalendar does. JDateChooser

JTable Column not editable after custom renderer

落爺英雄遲暮 提交于 2019-11-26 18:38:55
问题 This is a follow up to the question posted here. I've followed the instructions in the answer, and it worked like a charm. However, the date column cannot be edited: I cannot select any JDateChooser within the populated table. As mentioned in the earlier question, I'm using an MVC pattern. When I populate the JTable and setCellRenderer from within the view, it works fine. It is only when I populate and setCellRenderer from my controller that the date column isn't enabled. Here is the renderer

Disable multiple date ranges jDateChooser

社会主义新天地 提交于 2019-11-26 18:38:05
问题 I want to disable multiple date ranges on a JCalendar. I'm following these steps, but I need to know how can I add multiple date evaluators. Help me please, thanks. Update: I don't know why I can't disable the dates on my JCalendar. I will leave my code here so you guys can check it. This is my RangeEvaluator class, modified from this class. class RangeEvaluator implements IDateEvaluator { private DateUtil dateUtil = new DateUtil(); @Override public boolean isSpecial(Date date) { return false

Get the list of dates between two dates [closed]

拜拜、爱过 提交于 2019-11-26 17:25:36
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I'm using JDateChooser and I'm making a program that output the list of dates between the selected dates. for example: date1= Jan 1, 2013 // Starting Date date2= Jan 16,2013 // End Date then it will output Jan 2,

How to disable or highlight the dates in JCalendar

六眼飞鱼酱① 提交于 2019-11-26 16:57:25
问题 In my case i want to disable or highlight dates in Java calendar. I used JCalendar and DateChooserCombo and could not find a way to do it. Finally, I tried the below code and it also was not successful. For example: I want to disable all dates from 14-09-13 to 23-09-13 . DateFormat formatter = new SimpleDateFormat("yyyy-mm-dd"); try { Date d1 = formatter.parse("2013-09-14"); Date d2 = formatter.parse("2013-09-23"); jCalendar1.setSelectableDateRange(d1, d2); } catch (ParseException ex) { ex