如何在代号一中将doneListener添加到TextArea

How to add doneListener to TextArea in Codename One

TextField 有一个名为 setDoneListener() 的方法,它允许使用键盘搜索、输入或完成按钮执行某些操作。

我如何为 TextArea 实现相同的功能,或者有没有办法在键入时使 Textfield 多行?而不是向左滚动的单行文本。

我知道 putClientProperty("searchField", true);putClientProperty("sendButton", true);putClientProperty("goButton", true); 会在键盘上放置一个按钮,但是如何为 TextArea 添加此按钮的操作?

JTextArea.setLineWrap(boolean wrap) 方法可能就是您要找的。

Sets the line-wrapping policy of the text area. If set to true the lines will be wrapped if they are too long to fit within the allocated width. If set to false, the lines will always be unwrapped. A PropertyChange event ("lineWrap") is fired when the policy is changed. By default this property is false.

试试这个:

TextField multi = new TextField();
multi.setSingleLineTextArea(false);
multi.setRows(4);
multi.setColumns(20);
multi.setDoneListener(doneListener);