Results 1 to 2 of 2
  1. #1
    noisepoet is offline Member
    Join Date
    May 2007
    Posts
    1
    Rep Power
    0

    Default disabling JButtons after win in TicTacToe

    Hi. I've created a Tic-Tac-Toe program using JPanel and JButtons. Can anyone tell me how to disable the unclicked JButtons after X or O wins the game?

  2. #2
    levent Guest

    Default

    Hi noisepoet,

    Welcome to Java Forums. You are our 100th member ;)

    There is a setEnabled(boolean value) method for JButtons. you should call this method of the buttons you want to disable.

    For example for button named as myButton, you use the following code:

    Java Code:
    myButton.setEnabled(false);

Similar Threads

  1. TicTacToe
    By Thomas Covington in forum New To Java
    Replies: 1
    Last Post: 04-10-2008, 05:51 AM
  2. 2D Array of JButtons
    By stevemcc in forum AWT / Swing
    Replies: 1
    Last Post: 02-17-2008, 12:42 AM
  3. TicTacToe Game
    By Ebtihal in forum New To Java
    Replies: 0
    Last Post: 01-09-2008, 12:01 PM
  4. JButtons
    By fgasimzade in forum SWT / JFace
    Replies: 1
    Last Post: 12-25-2007, 06:39 AM
  5. TicTacToe
    By Joe3161 in forum New To Java
    Replies: 4
    Last Post: 11-25-2007, 07:47 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
  •