How to handle color selection in java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smallbrain
    New Member
    • Apr 2007
    • 1

    #1

    How to handle color selection in java

    Pls can anyone help me. I want to be able to select from 3 colors repeatedly awarding marks depending on color selected.I will have about 5 rounds of selection and in each round, I can select from the 3 available colors which come up randomly at various positions.
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by smallbrain
    Pls can anyone help me. I want to be able to select from 3 colors repeatedly awarding marks depending on color selected.I will have about 5 rounds of selection and in each round, I can select from the 3 available colors which come up randomly at various positions.
    Erm, I don't know whether or not I understand your question but for the random
    stuff have a look at the Collections.shu ffle() method. For the association
    of a Color with a mark, check out the Map interface and one of its
    implementing classes: the HashMap. I think a:
    Code:
    Map<Color, Integer> markMap= new HashMap<Color, Integer>;
    ... would do fine.

    kind regards,

    Jos

    Comment

    Working...