• Post Reply Bookmark Topic Watch Topic
  • New Topic

A message display  RSS feed

 
Amrita Dole
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have 2 buttons-
b1 and b2 on the top panel of a frame.
On clicking on b1 or b2 , I want to display a message the bottom panel of the frame as the case may be.
Which is the class/ method I can use to display the message in the message?
For eg-
on clicking b1, I want to display hello
on clicking b2, I want to display world
Thanks,
Amrita
 
Jason Steele
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
place a JLabel on the bottom panel.
then add an actionListener to your buttons.
Example:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!