0
星云CDateTime几乎无法输入日期和时间。有没有一个明智的开源替代品?SWT是否有可用的DateTime小部件?
星云CDateTime几乎无法输入日期和时间。有没有一个明智的开源替代品?SWT是否有可用的DateTime小部件?
使用org.eclipse.swt.widgets.DateTime
...
来源: 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();
}
}
真的很不错。比星云小部件好多了...
Regards,
我只是不喜欢小部件。任何其他想法? – Mauli 2010-07-14 07:49:31
使用'SWT.DROP_DOWN'而不是'SWT.CALENDAR',看起来好多了! – chris 2015-03-12 17:15:41