Swing/Java: How to use the getText and setText string properly

后端 未结 4 1598
青春惊慌失措
青春惊慌失措 2021-01-05 16:28

I\'m trying to make input nameField appear in a Label called label1 after a Button called button1 is clicked

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-05 16:59

    the getText method returns a String, while the setText receives a String, so you can write it like label1.setText(nameField.getText()); in your listener.

提交回复
热议问题