Results 1 to 3 of 3
  1. #1
    Leprechaun is offline Member
    Join Date
    Dec 2007
    Posts
    30
    Rep Power
    0

    Default [SOLVED] Disabling a button not working

    I have a button which I can't seem to disable.
    Java Code:
    JButton temp = (JButton)event.getSource();
    temp.setText("WHY?");
    temp.disable();
    The text is set to "WHY?" but the button is not disabled, that's the part I find odd.

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    disable() method is deprecated as of JDK 1.1 and was replaced by
    java.awt.Component.setEnabled(boolean)...

    try to use temp.setEnabled( boolean b )....
    Last edited by sukatoa; 04-24-2008 at 06:13 AM.
    freedom exists in the world of ideas

  3. #3
    Leprechaun is offline Member
    Join Date
    Dec 2007
    Posts
    30
    Rep Power
    0

Similar Threads

  1. requestFocusInWindow() not working
    By Iyengar in forum AWT / Swing
    Replies: 7
    Last Post: 01-02-2009, 05:44 PM
  2. calculator not working
    By Renegade85 in forum New To Java
    Replies: 5
    Last Post: 03-10-2008, 04:27 PM
  3. Applet button not working
    By letmeoutofhere in forum Java Applets
    Replies: 9
    Last Post: 11-14-2007, 01:15 PM
  4. disabling JButtons after win in TicTacToe
    By noisepoet in forum New To Java
    Replies: 1
    Last Post: 05-19-2007, 12:01 AM
  5. Working With ANT
    By JavaForums in forum Eclipse
    Replies: 0
    Last Post: 04-26-2007, 09:16 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
  •