• Post Reply Bookmark Topic Watch Topic
  • New Topic

button for one-time usage  RSS feed

 
bryan lim
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

how do i create a button that can only press once?

ie. once i press it, the button cannot be press the second time unless i restart the application.

regards
bryan
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add an ActionListener, which calls myButton.setEnabled(false).
 
bryan lim
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you for your help!!!
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
may i just ask why? i have been racking my brain for an application of this.

Wendy
being her usual self the nosey one
 
Campbell Ritchie
Marshal
Posts: 55772
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible use: submission of a payment. As soon as you click the button, it is disabled, so you can't pay twice by mistake.
 
Wendy Gibbons
Bartender
Posts: 1111
Eclipse IDE Oracle VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:One possible use: submission of a payment. As soon as you click the button, it is disabled, so you can't pay twice by mistake.

thank you
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!