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

    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


    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:

Similar Threads

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