File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Display message in a JTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Display message in a JTextField" Watch "Display message in a JTextField" New topic
Author

Display message in a JTextField

Adam Henson
Greenhorn

Joined: Dec 04, 2003
Posts: 1
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
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

In an ActionListener registered with the JButton, call setText("The String") on the JTextField.


[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display message in a JTextField
 
Similar Threads
altering a GUI object without triggering the listener
How to disable selection in a JTextField?
JTextField focus problem ( urgent !!!!!!)
form design
JOptionPane.showInputDialog to accept multiple inputs