简体   繁体   English

如何使 JFrame ..Jbutton 在 jtextfield 中获取输入?

[英]How To Make JFrame ..Jbutton to get the input in jtextfield?

Im making my project and I want to get the inputs in jTextField by pressing the jButton then display it it jLabel .我正在制作我的项目,我想通过按下jButton来获取jTextField的输入,然后将其显示为jLabel Please help.请帮忙。 Thanks.谢谢。

Add an action to the button and then in the action handler get the text from textfield element and set the retrieved text as in jlabel element .向按钮添加一个动作,然后在动作处理程序中从 textfield 元素获取文本并将检索到的文本设置为 jlabel 元素。 Jlabel.settext(jtextfield.gettext().trim()); jlabel.settext(jtextfield.gettext().trim());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM