Ok so i have two classes a tester class and a class that has the variable of drawing an ellipse. The program prints out 4 faces with 4 different colors. I want to store the users choice of one of the four choices in an array. Can someone help me do that.

For Example, if the user wants choice 1 he or she would input 1 and that choice should somehow fetch the shape and store it in an array for use later.

Im a beginner so try and explain in lamens terms :) THANKS so much

Tester Class

import javax.swing.*;
import java.util.*;
public class TestYourFace
{
 public static void main(String args[]) {
      JFrame frame = new JFrame();
      frame.setSize(850,850);
      frame.setTitle("Choose YOUR Features?");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      
      
      
      Face Component = new Face();
      frame.add(Component);
      
      frame.setVisible(true);
            
      }
  }
}

Class with the Shapes

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class Face extends JComponent
{
    Shape Head = new Ellipse2D.Float(0, 0, 150, 150);
    Shape Head2 = new Ellipse2D.Float(0, 200, 150, 150);
    Shape Head3 = new Ellipse2D.Float(0, 400, 150, 150);
    Shape Head4 = new Ellipse2D.Float(0, 600, 150, 150);
    
    public void paint(Graphics g) 
    {
        Graphics2D g2 = (Graphics2D)g;
    
        int Red1 =  205;
        int Green1 = 175;
        int Blue1 =  149;
        Color lightBrown = new Color(Red1, Green1, Blue1);
        int Red2 = 65;
        int Green2 = 255;
        int Blue2 = 234;
        Color torquise = new Color(Red2, Green2, Blue2);
        
        g2.setColor(lightBrown);
        g2.fill(Head);
        g2.setColor(torquise);
        g2.fill(Head2);
        g2.setColor(Color.YELLOW);
        g2.fill(Head3);
        g2.setColor(Color.GREEN);
        g2.fill(Head4);
    }
}

Can you show your solution so others can see it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.