Results 1 to 5 of 5
  1. #1
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Question how to enable JButton?

    Hi,

    there are two JButtons, Jbutton2 should be enabled when Jbutton1 is clicked, if not clicked Jbutton2 should be grayed out or disabled, how can i accomplish this?

    Regards
    Sandeep

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

    Default

    Perhaps the first button should be a JToggleButton rather than a JButton. The second button can be a JButton and can be enabled or disabled via its setEnabled(boolean enabled) method.

    For more specific help though, you'll need to post code, best of all an SSCCE

  3. #3
    yellowledbet is offline Senior Member
    Join Date
    Feb 2011
    Location
    Georgia, USA
    Posts
    122
    Rep Power
    0

    Default

    JButton2.setEnabled(true); //false to disable

  4. #4
    sandeep43 is offline Member
    Join Date
    May 2011
    Posts
    97
    Rep Power
    0

    Default

    Hi Fubarable,

    Thanks for your reply, i will try doing it, anything i get stuck i catch you back.

    Regards
    Sandeep

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,238
    Rep Power
    19

    Default

    Moved from 'New to Java'. 'sandeep43' please choose an appropriate section of the forums for your questions.

    db

Similar Threads

  1. Please help : JSP enable/disable button
    By kalyana in forum New To Java
    Replies: 3
    Last Post: 03-24-2011, 05:06 PM
  2. user enable MenuItem
    By Coiby in forum AWT / Swing
    Replies: 5
    Last Post: 02-26-2011, 06:03 AM
  3. How to enable Multibyte in netbeans
    By madhav1351 in forum Advanced Java
    Replies: 2
    Last Post: 10-01-2010, 03:59 PM
  4. How to enable Windows Lock?
    By chyrl in forum Advanced Java
    Replies: 2
    Last Post: 07-11-2010, 03:45 AM
  5. Enable next-gen plug-in
    By james.wendell in forum New To Java
    Replies: 0
    Last Post: 10-09-2009, 01:34 PM

Posting Permissions

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