• Post Reply Bookmark Topic Watch Topic
  • New Topic

JLabel

 
Amrita Dole
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Which method can I use to change the text displayed by JLabel?
The label is now showing - "abc".
On the click of a button, I want it to display "xyz".
Is JLabel good for this or should I use JTextField or something else?
Thanks,
Amrita
 
Jason Steele
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
label.setText("Text to display")
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can call the "setText(...)" method to update the text on a JLabel.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!