Solved

JDateTimeChooser?

Posted on 2000-03-21
3
397 Views
Last Modified: 2008-03-17
Hi,

I need a GUI widget to choose date and time.  Can you point me to one?

Thanks,

Alex.
0
Comment
Question by:akoifman
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
stalefish earned 100 total points
ID: 2642412
0
 

Author Comment

by:akoifman
ID: 2642744
Hi,

What about a Time widget.  

Thanks for the Date widget.

Alex.
0
 
LVL 2

Expert Comment

by:stalefish
ID: 2646673
I've search all over and can't seem to find one. Unless you want to pay money for a jClass package : http://www.klgroup.com/jclass/field/index.html

They do have somethng for time, but I think its pretty crappy.

Should be easy enough to design though. Something along the lines of:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TimeChooserPanel extends JPanel{
      private final static String[] AMPM = {"A.M.", "P.M."};
      private JComboBox hour, minute, ampm;
      
      public TimeChooserPanel(){
            super();
            create();
      }
      
      public void create(){
            hour = new JComboBox();
            minute = new JComboBox();
            ampm = new JComboBox(AMPM);
            for(int i = 1; i<12; i++) hour.addItem(Integer.toString(i));
            for(int i = 0; i<59; i++) minute.addItem(Integer.toString(i));
            this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
            this.add(hour);
            this.add(minute);
            this.add(ampm);
      }

}
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
what is a "java.lang.System Property"   ? 20 67
session migration servlets 2 36
eclipse apache tomcat admin console 52 97
eclipse buid path vs tomcat lib path 10 23
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 …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

777 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