我正在使用Java 8和NetBeans 8.0.2。
我无法通过右键单击jTextField来插入private void jTextField1KeyReleased(java.awt.event.KeyEvent evt)方法。
这是为了完成一个okBtnActionPerformed(java.awt.event.ActionEvent evt)方法。 允许用户使用“返回键”而不是“确定按钮”来放置数据。
I am working with Java 8 and NetBeans 8.0.2.
I can't insert a private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) method by right clicking into the jTextField.
This is to complete a okBtnActionPerformed(java.awt.event.ActionEvent evt) method. It is to allow user to put a data using the "return key" instead of "OK button".
最满意答案
它允许用户使用“返回键”而不是“确定按钮”来放置数据
然后,您可以将ActionListener添加到文本字段。 更具体地说,您可以添加添加到“确定”按钮的相同ActionListener。 然后,当焦点位于文本字段时,用户可以单击按钮或使用Enter键。
It is to allow user to put a data using the "return key" instead of "OK button"
Then you can add an ActionListener to the text field. More specifically you can add the same ActionListener that you add to the OK button. Then the user can either click on the button or use the Enter key when focus is on the text field.
更多推荐
发布评论