Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Random in dots How do i do it ?

  1. #1
    Junior Member
    Join Date
    Jul 2013
    Thanked 0 Times in 0 Posts

    Question Random in dots How do i do it ?


    I dont know if this is a advanced level of coding but i want to know how to make a random generator in dots.
    I know how to make the random numbers, JRadioButton, JButton, BorderLayout and all the beginner stuff but what do i need to know more.
    I want to have 5 dots in line and sat the randomness to 0-3 so if you push the button it will generate the dots in them.

    like if you have 5 dots = O O O O O
    and fill them up with the random dots

    sorry for my english

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 698 Times in 680 Posts

    Default Re: Random in dots How do i do it ?

    I don't really understand what you're trying to do, but your description makes me think of the 5 dots as a 5-digit binary number. If you think of it that way, you could generate a random number, 0 - 32, and fill in the 5 dots as though they were the ones in the binary version of decimal numbers 0 - 32.

    Good luck!

Similar Threads

  1. Drawing a square with stars and dots
    By steph.harrison in forum Java Theory & Questions
    Replies: 1
    Last Post: October 27th, 2012, 09:32 AM
  2. [SOLVED] Replacing dots with spaces
    By dTi in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 17th, 2011, 08:53 PM