File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Radio Buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Radio Buttons" Watch "Radio Buttons" New topic
Author

Radio Buttons

Yugendra Reddy Guvvala
Greenhorn

Joined: Aug 06, 2007
Posts: 14
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
Marshal

Joined: Mar 22, 2005
Posts: 35438
    
    9
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.


Android appsImageJ pluginsJava web charts
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 8562

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().


[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
Yugendra Reddy Guvvala
Greenhorn

Joined: Aug 06, 2007
Posts: 14
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

Joined: Feb 18, 2008
Posts: 56
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
Marshal

Joined: Mar 22, 2005
Posts: 35438
    
    9
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?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Radio Buttons
 
Similar Threads
I want to be a (Product) Model
Breaking News : Russian Plane Crash
Redrawing the UI
AM/FM is it available in the Android Hardware ? or can we do it in CODE?
WA #1.....word association