import org.eclipse.swt.widgets.Text;
...
private Text textora;
...
LocalTime ora = textora.getLocalTime();
我无法从文本格式中读取localtime变量进行输入
错误:
Multiple markers at this line
- The method getLocalTime() is undefined for the
type Text
- The method getTime() is undefined for the type
Text
1条答案
按热度按时间o2g1uqev1#
swt
Text
控件只是纯文本,只有getText
方法获取输入的字符串。将文本转换为LocalTime
您必须解析文本:import org.eclipse.swt.widgets.DateTime;
...
DateTime dt = new DateTime(parent, SWT.TIME);
...
LocalTime time = LocalTime.of(dt.getHours(), dt.getMinutes(), dt.getSeconds());