Link to home
Start Free TrialLog in
Avatar of InNoCenT_Ch1ld
InNoCenT_Ch1ld

asked on

Date Chooser?

Is there any class that provide the date chooser? sth like colorchooser and filechooser? so that whenever i click on the button, it will prompt out and allow the user to select the date..
I've been using JComboBox (date, month, year) to achieve that but there is too many error-checking to do, which year which month or date cannot choose.. and i dun think its performance is consider good as well..

any expert(s) can recommend me the method/class or give me some tips/hints?

-Child-
Avatar of Mick Barry
Mick Barry
Flag of Australia image

there a few 3rd party ones around.
A quick search on google should turn up a few.
Avatar of InNoCenT_Ch1ld
InNoCenT_Ch1ld

ASKER

objects>> have you use any date chooser before? maybe you can recommend to me ;)
Internally I use one I developed for a client, and the client owns the source so I can't share it.
ALso depends a bit on what sort of gui you want, plus how you want to incorporate it in your application.
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>how you want to incorporate it in your application.

this is always a problem.. ;)

i visited the websites that u suggest, but i'm not that sure how to integrate them to my app. maybe i should put in some effort to develop one for myself.. any advise/tips how to do it?

btw, can i integrate the java bean date choose to my java app? shouldnt be any problem rite?
besides, there's no point just to use other ppl's product, i wanted to learn how to do it as well...
if you can guide me through all the process, i am willing to increase the pts to 500. ;)

-Child-
> any advise/tips how to do it?

First decide what your requirements are. And perhaps have a look at existing chooser to get some ideas.
I use MonarchDate: http://www.singleton-labs.com/mdate.html

It's not very expensive and does a good job.
FesterWim>> not very expensive? hmm.. i'm a free software user cause most of the time, i create app just for my own personal use, or for fun.. learning java perhaps has become part of my life.. ;p

-Child-
for objects>> my requirement is basic and simple (for now), i just want to allow the user to select a date from the date chooser for the future activity.. the date selected will be save in the database. and everytime the user(i think the user will be no other person than myself!) run the app, the date will be loaded from database and show in the app..
i also want to be able to set the date for the past and future, wanna avoid the 29th of Feb..

any additional information that you needed?

oh, the date selected should be in the same format as getDate().
InNoCenT_Ch1ld>> I'm also a free software user most of the time, but for the application I created I needed a decent datechooser. It seemed like the best one at the time I made the choice, so I had to buy it. Ofcourse if this is a personal application I wouldn't buy it either. (But there is a free trial you can use :))
NOTE: I have no interest in that company or their products, I'm just a happy user.
FesterWim>> i've download the free trial product.. but there is no source code available right?

have you ever try to write one yourself? maybe we can work out one? ;)
just suggesting anyway..

-Child-
i wanted to develop a date chooser sth like those in the Time/Date properties of Windows. just that i wanted to get the date/time that i select and store in the database..

thinking of creating a panel with 7x5 buttons, get the calendar from the Time/Date properties and "put" them on my date chooser. so, the date/day will be show at the appropriate button. when i click on the button, it shall return the date so that i can use it or store it in the db..

two JComboBox to select the month and year.

hmm... how difficult or how easy to achieve this? i'm taking a close look on the sample code now, but i will appreciate if u guys give me some valueable comment..

Good day~

-Child-
Ofcourse there is no source code, as it is a closed-source component :)
Hi,

I had the same problem too.
I couldn't believe there wasn't some JDateChooser class in the JDK.
Such a basic functionality!

At last I found one at <http://www.geocities.com/mschliesman/prog_datechooser.htm>
It needed some changes/bug fixes, but now I have a datechooser I'm quite happy with.
(I'm using it in a professional product now)

Success.
Hello,

Some time ago I also needed one myself. I found the same as stated by zzynx. Unfortuately, it wasn't finished yet and the author wasn't interested in ever doing so. I asked for his permission to further develop it and the result can be found at http://users.skynet.be/notorious/DateChooser.java I added a few new features with the most important being I18n. I also made it a lot more compact an visualy more atractive.

I released it under GPL so you are free to do with it whatever you want.

Have fun!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hello zzynx,

by I18n I meen Internationalization ( I<18 letters>n ). This is about the fact that not in all countries the week starts at sunday. In my country it starts on monday for example. By implementing it, the DateChooser will automatically choose the format used in your country and all calculations and views will still be correct.

ArrowIcon is my mistake, its been a while since I worked on DateChooser, it can be found at http://users.skynet.be/notorious/ArrowIcon.java

The visual style fitted perfectly in my product :-), we can discuss this for hours but I'm not going to do that. If you want other colors, just change them. I have no problem with anyone doing that.

About those buttons: you've got a point there. When I changed DateChooser, I was under pressure of time and I don't needed them in my project so I left them out. If I ever can find some time I will probably put them back in.

Have a nice day!
dgovaert>> Releasing under GPL does not mean that the user is free to do what he wants. Any product using your code needs to be released under GPL also. There's the LGPL if you want to avoid this.
FesterWim>> Thanks for the tip, didn't know there was this otherone. Just as lots of other people never read the GPL, I just use it ;-). Maybe I should read it, since I'm nearly at the end of my studies, so I know what I'm actually doning. Anyway I changed it in the code, so be free to do whatever you want...

bye
Hi dgovaert,

   >by I18n I meen Internationalization ( I<18 letters>n ).
Oh I see. :)
Didn't hear this one before.

  >This is about the fact that not in all countries the week starts at sunday. In my country it
  >starts on monday for example.
In mine too.
I also live in Belgium. ;)

  >By implementing it, the DateChooser will automatically
  >choose the format used in your country and all calculations and views will still be correct.
That's a nice one. I had already "internationalized" the day labels via a translation.
(=pull the days through a resource bundle)
But I hadn't thought yet about a reordening of the day columns.
Good idea.

  >If you want other colors, just change them.
Of course.

Another thing I added is this:
whenever the user presses ESC when the calendar (=modal undecorated dialog) is visible,
it disappears.

I see that in your implementation (modeless undecorated dialog) you don't have that,
but clicking outside the calendar makes it disappear, something I don't have.

Now, I'd like to combine both.
So I changed my modal calendar dialog into modeless.
But it doesn't seem to be that easy:
pressing a day or a (month scroll) button in the calendar now stays without any reaction,
it is no longer "seen".
Any idea?
dgovaert && zzynx >> Maybe we should start our own Belgian section: I'm from Belgium also :)
zzynx>>
I can't think of anything right away that could cause this problem. Any way it sounds like a problem with your listeners (you probably already found that out yourself). I can tell you that this 'feature' works with a focuslistener and the methods for this are the two last methodes in the file.

btw, another 'feature' is that the popup chooses the best placing. If there isn't enough room below the textfield it pops up above, etc. It isn't that hard to implement but it is annoying it doesn't do that.

FesterWim>>
>Maybe we should start our own Belgian section: I'm from Belgium also :)
Good idea! When do we start?
wow, i sacrifice my sleep to try to do the Date chooser, and i theoritically, i think i already know how to do it.. so in fact, i login to this question just to ask you guys to stop posting comment.. but, hoho.. erm, what should i really do now? ;p
Clearly, move to Belgium ... (maybe not. I lived there for a while. Great chocolate, fabulous beer, not overly difficult language(s) [but everybody speaks English to varying degrees, which makes learning theirs impossible], terrible weather. I live in Sydney Australia now)
hmm, but i dun think i need to move to belgium to solve this problem rite? haha.. ;p

anyway, i need you guys to tell me who should i give the point to?

btw, i already form the formula to generate the calendar of buttons(5x7), so, the rest of the funcationality is up to me to add..

should i have any doubt in the future, i will post my question again, tks everyone!

-Child-
dgovaert>>
>I can't think of anything right away that could cause this problem. Any way it sounds like a
>problem with your listeners (you probably already found that out yourself). I can tell you
>that this 'feature' works with a focuslistener and the methods for this are the two last
>methodes in the file.
Indeed. I added them to my version. And clicking besides the calendar makes it disappear.
But for some mysterious reason mouse clicks in the calendar aren't seen.
And when I have to choose, I think I know it ;)
I'll have to dig in it.

>btw, another 'feature' is that the popup chooses the best placing. If there isn't enough >room below the textfield it pops up above, etc. It isn't that hard to implement but it is >annoying it doesn't do that.
Agree. That was one of the first fixes I added too.

Choosing a grey date (in the previous or next month) also had a bug: the chosen date was OK, but the month was not changed accordingly when you fold open the calendar afterwards.
I saw you fixed this one also.

InNoCenT_Ch1ld>>
1) You are going to program it yourself? That's good to learn something.
    But I was always thaught that a good developer is a lazy one.
    Meaning: "don't reinvent the wheel"
    (except for educational purposes which clearly is your case)
2) Points can be split up (parts given to several people)
    Up to you to decide who gave you the most useful information.
i use the links provided by objects for my research and understanding.. that's where i know the fundamental steps..

whereas zzynx really give me some extra idea of how to make the calendar better..

so i split the point between u guys.. no objection? ;)

zzynx>> "don't reinvent the wheel"
hmm, maybe you can say that i'm a bit 'stupid' to do thing myself. but i really 'hate' to use sth which i dun really know.. so before i use other ppls codes, i will definitely go get the basic idea of what is it.. how can it fit into my app, or am i able to develop one which is different (in coding) ?
i'm not a programmer, so time means nothing to me.. and i just wanted to learn, and have fun ;)

Java programming =  sth we all enjoy to do ya? ;)

-Child-
The process of learning Java is something that pull me out of the harsh reality, at least temporary...
>>whereas zzynx really give me some extra idea of how to make the calendar better..
That was indeed the goal. Glad it was helpful to you

>>so i split the point between u guys.. no objection? ;)
After a deep thought...... no, not really ;)
Thanks

>>i'm not a programmer, so time means nothing to me.
What a lucky guy you are! ;)
>>i'm not a programmer, so time means nothing to me.
What a lucky guy you are! ;)

perhaps? hahaa..but sometime i wish i am. coz if working = doing sth you like, that's perhaps the best thing on earth right? ;p but i know i still got lots of things to learn, with my limited time. the only thing i can do now is sacrifice my sleeping time to learn.. :( work too bz, what to do?

-Child-