aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Java: Concatenating Text in a JTextbox using JButtons? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Java: Concatenating Text in a JTextbox using JButtons?" Watch "Java: Concatenating Text in a JTextbox using JButtons?" New topic
Author

Java: Concatenating Text in a JTextbox using JButtons?

Nathe Chan
Ranch Hand

Joined: Mar 12, 2009
Posts: 33
Hi everyone,

I am stuck on Java. I have a JPasswordField, and I need to know how to solve this scenario. If I press JButtons on my box, they should be concatenated onto the textbox. What if I had JButtons named 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', and 'J'. How would I enter the JButtons to form a character password string such as 'C','H','A','A'? Can someone provide with the code to solve my problem? Sincerely, I do not have much time left on my hands and I need an answer ASAP.

Thank you very much,

Nathe
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

Each time you press a button, get the existing text in the text field. Then append the new text onto it. Then set the text + new text back on the text field.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Java: Concatenating Text in a JTextbox using JButtons?
 
Similar Threads
Music transcription program
Can anyone help me with Drag and Drop in swing?
GC of Objects within a JFrame
Help w/ custom JButton
Change color of JButtons in Java 5.0