This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get date from JDateChooser into the textfield

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have to use some sort of date picker just after the date textfield.
I have downloaded JCalender1.4 zip from webpage. But i don't know how to use it. I have looked into its api. i have added the JAR file to project's class path(i am using myeclipse8.5).

I have created a JDateChoose constructor and related it with a text field. It now displays the calender, but doesn't displays the date in the textfield. I think there would be some listener to do this. I guess ActionListener. But i don't know how to proceed

Here is what i did



Thanks
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked at that page you linked to, and I noticed a mention of demo code. I suggest you look at that demo code, find something which does what you want to do, and use the code from that demo.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Paul Clapham
I had an eye upon the code, but, didn't got any help
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still no success
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Did you get this line of code from one of the demo programs?
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.

I wrote it. i saw that JDateChooser has an add method which take component as an argument. I tried it. But, i am not sure whether its right or wrong
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know about "right" and "wrong" but your test clearly shows that it doesn't do what you expected it to do. Again I suggest that you look at the demo code which you have readily available.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. I am having a look on it.

(I guess you are talking about JCalenderDemo.java)
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still unsuccessful

Actually, i didn't spent much time on it, as i am late to meet the deadline of my project.

See, if you can provide some close hints.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Didn't got any help from demo code. Actually, didn't understood many things.

 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't looked at the documentation, but I would expect the JDateChooser to have a method named getDate() -- or something very much like that -- which returns the Date which the user chose. That's what you should be using.
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul Clapham

That was quite simple. It was so stupid of me.

Once again, thanks a lot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic