Solved

JDateTimeChooser?

Posted on 2000-03-21
3
387 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
json example 39 115
bitbucket vs gitbucket 3 34
eclipse package explorer vs project explorer view 2 33
eclipse formatting 6 43
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

747 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

9 Experts available now in Live!

Get 1:1 Help Now