开发者

Is there a useable DateTime widget for SWT?

开发者 https://www.devze.com 2023-01-04 19:34 出处:网络
The Nebula CDateTime is nearly unusable for 开发者_Python百科entering both date and time. Is there a sensible open source alternative?Use org.eclipse.swt.widgets.DateTime ...

The Nebula CDateTime is nearly unusable for 开发者_Python百科entering both date and time. Is there a sensible open source alternative?


Use org.eclipse.swt.widgets.DateTime ...

Source: http://www.eclipse.org/swt/snippets/

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;


public class SWTExample 
{
public static void main (String [] args) 
{
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout (new RowLayout ());

    DateTime calendar = new DateTime (shell, SWT.CALENDAR);
    calendar.addSelectionListener (new SelectionAdapter() {
        public void widgetSelected (SelectionEvent e) {
            System.out.println ("calendar date changed");
        }
    });

    DateTime time = new DateTime (shell, SWT.TIME);
    time.addSelectionListener (new SelectionAdapter () {
        public void widgetSelected (SelectionEvent e) {
            System.out.println ("time changed");
        }
    });

    shell.pack ();
    shell.open ();
    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}

}

It is really good. Much better than nebula widget ...

Regards,

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号