• Post Reply Bookmark Topic Watch Topic
  • New Topic

JButtons

 
Paul de Wit
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone,

Im creating a GUI where if the user clicks a Button the button will then disable so you cannot press it anymore then I need the name of the button to be changed. For example a button is called "Press me" and then when pressed it is then called "Button pressed" anyone know how to do that??

Greatly Appreciated

Paul
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking for anything beyond the setText method?
 
Tim Manchester
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To find the button, you need to look at your code. Somewhere in there you find where at least one jButton object is created. Look for code along the lines of:


It will take some sleuthing on your part, but only you have the source code so you'll have to look it up. Once you have the the name of the jButton variable, you'll need to look for the buttons action. This method is where you'll place your call to jButton.setEnabled(false).

If this is a bit technical for you I can only suggest you find a good swing tutorial, read and step through it. It will really help.

Regards,

- Tim Manchester
 
Paul de Wit
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeff

Thats all I needed to know can't believe I couldn't find it on the web anywhere it was so simple!!
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!