This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Does Swing or AWT have a component for entering a date? I'm picturing a button that the user clicks that causes a calendar to popup. Then the user can choose the date.
Also is there something similar for time? Perhaps a JFormattedTextField will be sufficient for my needs here, but a "calendar picker" of some sort would be much more convenient for the date.
Here's something to play around with. It's a bit rough - old code, I should clean it up (maybe one day)
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
Thanks. I'll take a look at this code to see if it helps. I'm still wondering if Swing (or any other standard Java API) provides this functionality?
Dr Black
Greenhorn
Joined: Sep 12, 2003
Posts: 1
posted
0
There is a free calender program with a popup month calander that you can pick the date and it puts it in the date text field. Do a Google on 'java calendar examples'. If you use a database I have found that always storing the date as 'timestamp' solves lots of problems. Move the date around using java,util,Date keeps things neet and orderly. If you store the date as timestamp the same data can be shown on the screen as a date in one field and time in a different field using the Java 'simple.date.format' classes on the same timestamp field.
timestamp is ALWAYS stored as YYYMMDDhhmmssss even though you may specific fewer characters to the database.
Background<br />Linux, MySQL, Zaurus, COBOL, etc.
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
Thanks for your comments. Unfortunately (or perhaps fortunately), this program will deal with flat files for persistant storage.