Results 1 to 4 of 4

Thread: Date Inputs

  1. #1
    hiranya is offline Member
    Join Date
    Jun 2007
    Location
    Colombo, Sri Lanka
    Posts
    32
    Rep Power
    0

    Default Date Inputs

    Hi,
    I want the user to enter a date value. What is the Java way of doing this? In .NET they have an object called DateTimePicker for this purpose. Is there a similar object in Swing?

    Regards,
    Hiranya

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Is there a similar object in Swing?
    Not as far as I know as of j2se 1.5
    There may be some private or public apps that do this.
    You can make up something that will do this for you. It is difficult to have a user enter a date string in a textField and then try to parse it. You can provide components such as JSpinners for the user to select a day, month and year from. This way you can control how the data is handled and eliminate parsing miseries. Just depends on what you want to do.

  3. #3
    hiranya is offline Member
    Join Date
    Jun 2007
    Location
    Colombo, Sri Lanka
    Posts
    32
    Rep Power
    0

    Default

    I'm not very familiar with JSpinners. Could you give some more information on JSpinners. How do we specify the range of values in a JSpinner? Can we use JSpinners with Strings?

    Regards,
    Hiranya

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    Could you give some more information on JSpinners.
    How to Use Spinners
    How do we specify the range of values in a JSpinner?
    This is done via the SpinnerModel for each spinner - see JSpinner api.
    Can we use JSpinners with Strings?
    Yes, with a SpinnerListModel.

Similar Threads

  1. java.util.Date vs java.sql.Date
    By Jack in forum New To Java
    Replies: 5
    Last Post: 10-28-2010, 02:59 PM
  2. Difference between current date and anothe date
    By vijay balusamy in forum New To Java
    Replies: 1
    Last Post: 04-16-2008, 04:15 PM
  3. Java program that stores user inputs
    By staticy2003 in forum Advanced Java
    Replies: 6
    Last Post: 01-24-2008, 07:46 PM
  4. Calendar.DATE
    By mew in forum New To Java
    Replies: 1
    Last Post: 01-04-2008, 07:51 PM
  5. Date comparison
    By Rageagainst20 in forum New To Java
    Replies: 0
    Last Post: 12-19-2007, 06:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •