简体   繁体   English

Java GUI-显示JTextField值

[英]Java GUI - Display JTextField Value

Link to code pastiebin 链接到代码pastiebin

I have a JTextField on my first GUI window. 我的第一个GUI窗口上有一个JTextField。 Later in the program I open another GUI and go to display the value of the JTextField but in the program I get an error of invalid layout. 稍后在程序中,我打开另一个GUI并显示JTextField的值,但是在程序中,我收到无效布局的错误。 I'm not sure what I need to change to get it to display the correct value. 我不确定我需要更改使其显示正确的值。

Picture for reference 图片供参考

在此处输入图片说明

JLabel supfirst = new JLabel("Supervisors First Name :" + firstvalue.getText());

.getText() is probably what you're missing. .getText()可能是您所缺少的。

This is what displays the content from the input field. 这就是显示输入字段中内容的内容。

在此处输入图片说明

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

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