Solved

Date Chooser?

Posted on 2003-11-16
32
1,851 Views
Last Modified: 2011-10-03
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-
0
Comment
Question by:InNoCenT_Ch1ld
  • 12
  • 5
  • 5
  • +3
32 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9761680
there a few 3rd party ones around.
A quick search on google should turn up a few.
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9761811
objects>> have you use any date chooser before? maybe you can recommend to me ;)
0
 
LVL 92

Expert Comment

by:objects
ID: 9761843
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.
0
 
LVL 92

Accepted Solution

by:
objects earned 25 total points
ID: 9761858
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9761954
>>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?
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9761966
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-
0
 
LVL 92

Expert Comment

by:objects
ID: 9762006
> 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.
0
 
LVL 1

Expert Comment

by:FesterWim
ID: 9762046
I use MonarchDate: http://www.singleton-labs.com/mdate.html

It's not very expensive and does a good job.
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9762072
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-
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9762094
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().
0
 
LVL 1

Expert Comment

by:FesterWim
ID: 9762178
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.
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9762278
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-
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9762493
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-
0
 
LVL 1

Expert Comment

by:FesterWim
ID: 9762507
Ofcourse there is no source code, as it is a closed-source component :)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 9762939
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.
0
 
LVL 1

Expert Comment

by:dgovaert
ID: 9763314
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!
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 37

Assisted Solution

by:zzynx
zzynx earned 25 total points
ID: 9763490
Hi dgovaert,

I immediately went to your site to copy the code and compile it. :)
To see what you changed (I don't know what you mean with I18n)
I got:
                cannot resolve class ArrowIcon
Of course that's no big deal: I replaced
                new JButton(new ArrowIcon(ArrowIcon.WEST));
with the original
                new BasicArrowButton(BasicArrowButton.WEST);

About the fact that you made it visually more attractive.
Your changes absolutely don't fit in the look of my product.
But, that's a matter of taste of course.

But, this is not a matter of taste: I don't find the "Today" or "None" button.
* The first can be handy if you need to change a date "1-jan-1998" into a date that is (close to) today.  (Or you need to add some more buttons to scroll through the years instead of the months)
* The "None" button is needed in case the user must be able to change a date into an undefined value. (This is a real life spec in my app)

InNoCenT_Ch1ld, I hope this considerations are helpful for you to decide what you need.
0
 
LVL 1

Expert Comment

by:dgovaert
ID: 9763689
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!
0
 
LVL 1

Expert Comment

by:FesterWim
ID: 9763758
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.
0
 
LVL 1

Expert Comment

by:dgovaert
ID: 9763893
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
0
 
LVL 37

Expert Comment

by:zzynx
ID: 9764013
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?
0
 
LVL 1

Expert Comment

by:FesterWim
ID: 9764703
dgovaert && zzynx >> Maybe we should start our own Belgian section: I'm from Belgium also :)
0
 
LVL 1

Expert Comment

by:dgovaert
ID: 9764904
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?
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9768256
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
0
 
LVL 2

Expert Comment

by:prcsn1
ID: 9768966
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)
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9769465
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-
0
 
LVL 37

Expert Comment

by:zzynx
ID: 9769492
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.
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9769778
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-
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9769787
The process of learning Java is something that pull me out of the harsh reality, at least temporary...
0
 
LVL 37

Expert Comment

by:zzynx
ID: 9769826
>>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! ;)
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 9769901
>>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-
0
 
LVL 92

Expert Comment

by:objects
ID: 9774482
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 62
count11 challenge 6 49
PDFBox - convert image to PDF, PDF resolution 3 70
create a gui in perl 3 46
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now