Results 1 to 4 of 4
  1. #1
    apaandmomo is offline Member
    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0

    Default Is there a way to make a jbutton unclickable in java?

    Is there a way to make a jbutton unclickable in java?
    hi i have a grid of buttons. when clicked a letter appears on the button. is it possible to make the button no loger clickable after it has been clicked and the character is shown? preferably the char is still visible after it is unclickable thx

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Is there a way to make a jbutton unclickable in java?

    1. Call setEnabled(false) on the button, or
    2. Remove the ActionListener from the button, or
    3. Leave the ActionListener in place but give it logic to allow it to not do any actions if desired, perhaps controlled by a boolen.
    4. Or many other ways....

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,252
    Rep Power
    19

    Default Re: Is there a way to make a jbutton unclickable in java?

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Is there a way to make a jbutton unclickable in java?

    Quote Originally Posted by DarrylBurke View Post
    Original poster, next time, please have the decency to let us know when you cross-post. If you do this a lot without notifying us, there are many who will decide not to help you in the future, and I don't blame them. Who wants to waste time helping if there's a likely chance that an answer has been provided elsewhere. It's simply a matter of being considerate of the free time of others.

Similar Threads

  1. Replies: 1
    Last Post: 01-15-2013, 06:44 PM
  2. JMenu bar - adding an unclickable bar section?
    By DrMadolite in forum AWT / Swing
    Replies: 11
    Last Post: 08-18-2012, 05:04 PM
  3. Help, I can't make the JButton to work properly
    By furieux in forum New To Java
    Replies: 11
    Last Post: 01-07-2012, 05:13 PM
  4. ActionListener for JButton after changing Button to JButton
    By ravi.joshi53 in forum Java Applets
    Replies: 2
    Last Post: 10-07-2011, 07:35 AM
  5. How to make a JButton disappear?
    By diab01ical in forum New To Java
    Replies: 2
    Last Post: 06-04-2008, 02:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •