• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JCalendar Date Picker question

 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello. I need to use a datePicker, and I found the one made by TOEDTER ( http://www.toedter.com/en/jcalendar/ ). It seems pretty good, and mainly just what I need, but I don't know how to use it. I developed my project in Netbeans, but the problem is that I create all my components manually (ex: JTextField f= new JTextField()), and place them on the screen and assign actions by writing code, and the tutorials that I found that teach you how to use JCalendar involve adding the JCalendar to the palette and put it on your frame through drag and drop. Having the project (it has a jar file where all the JCalendar classes are included), how can I include it in my own application? I don't know, maybe it can be included with something similar to "import javax.swing.*;" ?
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After you've added the JAR file to your project's class path, that's indeed all you need to do - import the right class(es). You would need to import at least com.toedter.calendar.JCalendar; you can then use any of JCalendar's constructors to create your instance.
 
Rus Corina
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much, I finally managed to do that myself. Now I have another problem: can the way in which the date is displayed in the text field be changed?
 
Rob Spoor
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're using a JDateChooser instead of a JCalendar, then I think that you can use setDateFormatString for that.
 
Rus Corina
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, i tried this, and it works except for the month. It just writes dd.33.yyyy, regardless of what month i choose.

The code i wrote is like this:
datt.setDateFormatString("DD.MM.YYYY");
Any idea why it does not work for month?
 
Rob Spoor
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to use "dd.MM.yyyy". The case is very important; lowercase "mm" means minute. That works for me.
 
Rus Corina
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It worked for me too. Thanks
 
Rob Spoor
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
reply
    Bookmark Topic Watch Topic
  • New Topic