jcalendar

JDateChooser : MouseClicked event doesn't get fired

Deadly 提交于 2019-12-24 09:38:51
问题 I want to double click on a JDateChooser to make it enabled. So I use a MouseListener : jDateChooser1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { System.out.println("mouse clicked"); } }); But this event doesn't get fired, nothing happend. The date chooser is the com.toedter.calendar one : Any suggestion ? Solution The JDateChooser is a Panel, and I have to listen to a mouse event from on component in the panel. JDateChooser

Why is firePropertyChange(String propertyName, Object oldValue, Object newValue) protected and not public?

我是研究僧i 提交于 2019-12-24 03:20:45
问题 Well the thing is I'm working on a IDateEditor interface implementation from JCalendar library and I've noticed that Component.firePropertyChange(String propertyName, Object oldValue, Object newValue) method is not public but protected. The situation is illustrated below: public class DateFormattedTextField implements IDateEditor { private JFormattedTextField editor; private DateUtil dateUtil; ... @Override public void setDate(Date date) { Date oldDate = (Date)editor.getValue(); if(dateUtil

Why is firePropertyChange(String propertyName, Object oldValue, Object newValue) protected and not public?

元气小坏坏 提交于 2019-12-24 03:20:08
问题 Well the thing is I'm working on a IDateEditor interface implementation from JCalendar library and I've noticed that Component.firePropertyChange(String propertyName, Object oldValue, Object newValue) method is not public but protected. The situation is illustrated below: public class DateFormattedTextField implements IDateEditor { private JFormattedTextField editor; private DateUtil dateUtil; ... @Override public void setDate(Date date) { Date oldDate = (Date)editor.getValue(); if(dateUtil

Using JCalendar in a JDialog

巧了我就是萌 提交于 2019-12-20 05:45:23
问题 My program uses JDialog s to open up forms and in the form I want to use JCalendar for the user to select a date and for me to use it for other methods afterwards. I have downloaded JCalendar library. I read some example codes but still not sure how to do it. I have an idea that in the form you press a button (Select Date) and like a small window opens with that JCalendar and when the date is selected it is displayed in the form as a TextField. Can someone recommend me some method of doing

convert string into date format in java

南楼画角 提交于 2019-12-20 04:43:50
问题 I want to convert this string to the following date format. String s = "2-26-2013"; Date date = new SimpleDateFormat("EEEE, MMMM/dd/yyyy").parse(s); System.out.println(date); I'm getting this error: Exception in thread "main" java.text.ParseException: Unparseable date: "2-26-2013" at java.text.DateFormat.parse(DateFormat.java:357) 回答1: Well yes. The argument you pass into the constructor of SimpleDateFormat says the format you expect the date to be in. "EEEE, MMMM/dd/yyyy" would be valid for

Adding actionListener to jCalendar

别来无恙 提交于 2019-12-19 04:10:31
问题 How would I add an actionListener to the jDayChooser component of an existing jCalendar placed using netbeans? I would like to only trigger an event only when the day buttons are clicked. as the propertyChange in jCalendar listens to even the jMonthChooser and jYearChooser P.S. using toedter's jCalendar 回答1: Alternatively, you can listen for the specific propertyName , "day" . JDayChooser jdc = new JDayChooser(); jdc.addPropertyChangeListener("day", new PropertyChangeListener() { @Override

How to show only date after the date of today in JCalendar

佐手、 提交于 2019-12-17 20:35:54
问题 i'm trying to limit user to select only the date after today, or select date after another Date I see on JCalendar API something that could help me but i didn't find nothing.. how can i do it? 回答1: I do not think there is a straight forward way on the component to do this. One way, that I know of is to use the setSelectableDateRange(Date from,Date to) - When you set the from date to current date, all previous day cells, year/month drop downs becomes disabled. Example: JCalendar calendar = new

How to use JCalendar to select an element of my array?

巧了我就是萌 提交于 2019-12-12 18:08:40
问题 I have a 3D array that contains 38 years, 12 months, and 31 entries for each month (regardless of how many days in that month). Like so: array[38][12][31] . I also have a JCalendar that is doing nothing now except looking pretty, and the JCalendar has a button underneath. How would I make it so that I can select a date in the calendar, then press the button and it returns the element of my array that would correspond to that date? Something like if(buttonPressed){ year = chosenYear - 1975;

Java add icon to JCalendar

夙愿已清 提交于 2019-12-11 12:28:12
问题 I'm trying to add an icon to a specific day into a JCalendar , but I can't. How can I do that? I have this code: final JCalendar calendar = new JCalendar(); JDayChooser day= calendar.getDayChooser(); day.setAlwaysFireDayProperty(true); day.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { //put icon here ImageIcon icon = new ImageIcon("icon.png"); JLabel label = new JLabel(icon); day.add(label); } Edit : I want the icon in a day. 回答1:

How to set date picker initial value?

◇◆丶佛笑我妖孽 提交于 2019-12-11 11:43:27
问题 I have a date_picker from toedter.com from jcalendar package which are swing components. How can I set an initial value to it? I'm using netbeans. I added the date_picker on design view and tried this on my source code : UtilDateModel model = new UtilDateModel(); model.setDate(2014, 8, 24); model.setSelected(true); but I've been playing around where to put it still doesn't seem to work. Any idea guys? 回答1: You can try this out : String dateValue = "initial date value"; // must be in (yyyy- mm