• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java: Concatenating Text in a JTextbox using JButtons?

 
Nathe Chan
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!