[英]Is there a useable DateTime widget for SWT?
The Nebula CDateTime is nearly unusable for entering both date and time. Nebula CDateTime几乎不可用于输入日期和时间。 Is there a sensible open source alternative?
是否有明智的开源替代方案?
Use org.eclipse.swt.widgets.DateTime
... 使用
org.eclipse.swt.widgets.DateTime
...
Source: http://www.eclipse.org/swt/snippets/ 资料来源: 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, 问候,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.