java 8 neatbeans 8.0.2 swing组件jTextfield(java 8 neatbeans 8.0.2 swing component jTextfield)

编程入门 行业动态 更新时间:2024-10-15 08:22:05
java 8 neatbeans 8.0.2 swing组件jTextfield(java 8 neatbeans 8.0.2 swing component jTextfield)

我正在使用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.

更多推荐

本文发布于:2023-07-15 17:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1116667.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组件   java   neatbeans   component   jTextfield

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!