Results 1 to 8 of 8
  1. #1
    Inferna is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Post Radio Button Random Number Generator

    Hello!

    I have just downloaded eclipse. I am 100% brand new to java. I was wondering if anyone knows how to do this:

    I have three radio buttons: 'Max 10', 'Max 100', and 'Max 1000'. These are my upper limits for the button, which generates the number using the radio buttons to alter the upper limit. I have no idea what to enter, the most I have found is:
    int randomIndex = generator.nextInt( n ); where n = upper limit.
    I am using the android SDK plugin also.

    Thanks!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,532
    Blog Entries
    7
    Rep Power
    20

    Default Re: Radio Button Random Number Generator

    Put those JRadioButtons in a ButtonGroup; at most one of them can be selected. The ButtonGroup object tells you which one. This only applies to Swing; for Android ask this in the Android sub-forum.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Radio Button Random Number Generator

    Quote Originally Posted by Inferna View Post
    I am using the android SDK plugin also.!
    Is this a question about Android or Java? Note that the two use separate and distinct GUI toolkits.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Radio Button Random Number Generator

    Quote Originally Posted by JosAH View Post
    Put those JRadioButtons in a ButtonGroup
    If this is at all about Swing.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    Inferna is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Re: Radio Button Random Number Generator

    Quote Originally Posted by DarrylBurke View Post
    Is this a question about Android or Java? Note that the two use separate and distinct GUI toolkits.

    db
    Using Eclipse, to make a very simple generator app. It has both a .java and a .xml tab.

    Be patient with me, I'm VERY new!

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Radio Button Random Number Generator

    The question is, are you creating a Java app or an Android app?

    If you don't know the answer to that then you're not creating anything.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    Inferna is offline Member
    Join Date
    Jun 2013
    Posts
    4
    Rep Power
    0

    Default Re: Radio Button Random Number Generator

    Quote Originally Posted by DarrylBurke View Post
    The question is, are you creating a Java app or an Android app?

    If you don't know the answer to that then you're not creating anything.

    db
    Sorry! It's an android application project.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,244
    Rep Power
    19

    Default Re: Radio Button Random Number Generator

    Moved from New to Java.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Random number generator
    By adjit in forum New To Java
    Replies: 9
    Last Post: 03-05-2012, 04:09 PM
  2. Random number generator with range.
    By hifriend in forum New To Java
    Replies: 2
    Last Post: 11-15-2011, 08:12 PM
  3. Help with Random Number Generator
    By celtics in forum New To Java
    Replies: 0
    Last Post: 03-07-2011, 08:18 PM
  4. Random number generator
    By zerwik in forum New To Java
    Replies: 3
    Last Post: 12-26-2010, 12:10 PM
  5. Random number generator
    By Michailangelo in forum Advanced Java
    Replies: 4
    Last Post: 04-02-2010, 06:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •