|
|
|
|
|
Re: DateTime widget with 12h format not working [message #756925 is a reply to message #756888] |
Tue, 15 November 2011 14:53 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Midnight is 12:00AM on a 12-hour clock. The snippet below sets and then
gets the noon and midnight hours, it works for me on Windows 7.
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
new Label(shell, SWT.NONE).setText("Noon:");
DateTime dt1 = new DateTime(shell, SWT.TIME);
dt1.setTime(12, 0, 0);
new Label(shell, SWT.NONE).setText("Midnight:");
DateTime dt2 = new DateTime(shell, SWT.TIME);
dt2.setTime(0, 0, 0);
shell.pack();
shell.open();
System.out.println("Noon hour: " + dt1.getHours());
System.out.println("Midnight hour: " + dt2.getHours());
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
Grant
On 11/15/2011 7:46 AM, Loris wrote:
> Yes, but you can't enter 00:00 AM in the widget, entering 00:00 AM and
> changing focus triggers an automatic change from 00:00 AM to 12:00 PM.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03342 seconds