• Post Reply Bookmark Topic Watch Topic
  • New Topic

Radio Buttons  RSS feed

 
Yugendra Reddy Guvvala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am devoloping a Tic Tac Toe game which plays Computer Vs User but i dont know how i would design a radio button which makes a choice who will play first
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know how radio buttons work in general? Have you worked through the relevant section of the Java Tutorial?

I'll move this to the AWT/Swing/GUI forum, since there seems to be nothing applet-specific in the question.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Yugendra Reddy Guvvala:
...choice who will play first


If I understand your problem correctly, you want something which will decide who gets to play first, just like flipping a coin or something and you want to represent it using a radio button.

The Random class has many useful methods which you can use. First which comes to mind is the nextBoolean().
 
Yugendra Reddy Guvvala
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I have developed the TIC TAC TOE application in which user plays with computer my question is
I want to have a window displayed first asking whether the user have to play first or the computer. Which should have 2 radio buttons and one yes button and one cancel button and the window should return either user or computer to the program then the game should start accordingly
I know how to do it in HTML but not in JAVA I tried some radio button examples but could not find current answer relevant to my question
 
Austin Lee
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the user can decide who is first, I think you can use the raido button swing and it's easy , you need read the tutorial.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What specifically are you struggling with? If you have code that shows two radio buttons, and code that checks which of the buttons is selected, then what you're trying to do should be easy, shouldn't it? What do you have so far?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!