jcalendar

JCalendar getting date

匆匆过客 提交于 2019-12-11 07:35:16
问题 In my project I am using com.toedter.calendar.JCalendar class. But I do not know how can I get date when date is chosen. JDateChooser and JXDatePicker met my need. There is a code that provides date when a date is chosen from JDateChooser. JDateChooser picker=new JDateChooser(); picker.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { setDate(picker.getDate()); } }); 回答1: You definitely want addPropertyChangeListener() ,

JDateChooser display language

主宰稳场 提交于 2019-12-11 04:28:00
问题 I'am using JCalendar 's 1.4 JDateChooser so I ask if it is possible to change display names for months and days of weeks without having to change the source code, or, since I never looked the source code, is it complicated to change it even if it can be changed. Thanks. 回答1: JCalendar responds correctly to supported locales. For example, the locale illustrated below is specified on the command line: java -Duser.language=fr -Duser.country=FR -cp build/classes DateDemo Additional localized text

Can not retrieve date from JDateChooser in Java

て烟熏妆下的殇ゞ 提交于 2019-12-11 02:01:54
问题 I am using JDateChooser from here However I can not retrieve the date in format set with the method setDateFormatString while displaying it in console. In first label shows actual date retrieved from JDateChooser while second label shows the format which I have set. When I select date from JDateChooser I get the date as 22-07-2011 as shown in image. But when I use getDate method, it will give me date as Fri Jul 22 00:00:00 GMT+05:30 2011 . I want only 22-07-2011 . Here is my code. I am using

Date picking and finding difference

烂漫一生 提交于 2019-12-10 23:37:27
问题 I am a novice to Java programming using Netbeans. I have added jCalendar to my GUI to pick a date. I have entered this line in Events -> "property change" code of jCalendar button, Date date=jcalendar1.getDate(); So that I get the date immediately when it is changed. Am I right? The purpose: I want to find the difference in milliseconds from the afternoon (12:00 pm) of this date above to NOW (current date and time). There are several programs showing the date difference but all have dates

JCalendar set specific date colors

青春壹個敷衍的年華 提交于 2019-12-10 12:22:57
问题 I am using the code from the solution to set the colors of a specific date in toedter's JCalendar at Add specific background colors to JDaychooser Dates. The problem with this solution is that it sets a different day for each month because the first day for each month is different. in my example i have added 4th of May and 4th of September in the events arraylist.+9 from the day works for May but in September it will select 7 instead because the first day of the month starts at +6. I'm

JCalendar Focus Event

邮差的信 提交于 2019-12-08 17:27:37
I use JCalendar 's JDateChooser in a table date column as a tablecelleditor . The problem is that when the column cell clicked JDateChooser appears but if it loses its focus it does not fire focus lost event. How to make it fire focus lost event? And after doing this is there any way to prevent its firing focus lost when JCalendar appeared after clicking the JCalendar Button? The thing I try to do is if some one specify a date by selecting a date from the calendar stopCellEditing(); Else wait until focus lost event to stop or cancelCellEditing(); MOD I found a propertyChanged event in

How to set “off” all the toogle day buttons in jCalendar?

谁说胖子不能爱 提交于 2019-12-08 07:24:33
问题 I'm using the toedter's jCalendar and triggering events when the day buttons are clicked using the following code: JDayChooser jdc = jCalendar.getDayChooser(); jdc.addPropertyChangeListener("day", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { date = jCalendar.getDate(); new AgendaFrame(date, user).setVisible(true); } }); The thing is that when jCalendar initiates, the button which matches the current date is already pressed and so, I'm unable to

JCalendar Focus Event

喜你入骨 提交于 2019-12-08 05:12:58
问题 I use JCalendar's JDateChooser in a table date column as a tablecelleditor . The problem is that when the column cell clicked JDateChooser appears but if it loses its focus it does not fire focus lost event. How to make it fire focus lost event? And after doing this is there any way to prevent its firing focus lost when JCalendar appeared after clicking the JCalendar Button? The thing I try to do is if some one specify a date by selecting a date from the calendar stopCellEditing(); Else wait

JCalendar multiple day selection

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 05:49:19
问题 Is it possible to select multiple days in toedter's JCalendar? Like I would be able to highlight 2 or 3 days in the calendar and then get the days highlighted after I would trigger an event using a button. or should i be better off using a JTable for a calendar? 回答1: I'd use a one column JTable having a JDateChooserCellEditor and a custom renderer. DemoTable is an example, seen here. The TableModel should contain a List<java.util.Date> , as Date implements Comparable for easy sorting. You can

Disable past dates and 2 weeks from now in JCalendar

谁都会走 提交于 2019-12-02 18:59:54
问题 I want to disable past dates and 2 weeks from now from a JCalendar . I already have this code: jDateChooser1.getJCalendar().setMinSelectableDate(new Date()); ((JTextFieldDateEditor)jDateChooser1.getDateEditor()).setEditable(false); I already can disable past dates but how about disabling future dates like 2 weeks from now? 回答1: As shown here, you can use an IDateEvaluator like MinMaxDateEvaluator to invalidate a range of dates: private static class RangeEvaluator extends MinMaxDateEvaluator {