Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Display message in a JTextField  RSS feed

 
Adam Henson
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I allocate a text string to a JTextField?
I need a message to be displayed in the field when a JButton on the pane is clicked.. What is the best way of doing this?
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an ActionListener registered with the JButton, call setText("The String") on the JTextField.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!