【发布时间】:2021-03-19 17:04:08
【问题描述】:
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
【问题讨论】:
-
Text只是纯文本,只有getText方法。您必须解析该文本才能获得日期。 -
如果您希望用户输入日期,您可能还想查看 SWT
DateTime控件。 -
我想要的不是日期,而是时间
-
DateTime表示日期或时间。对于Text,您仍然需要解析时间。