@leeappelbaum/

bulls_eye

Java Swing

No description

fork
loading
Files
  • Main.java
  • ColorPanel.java
  • nohup.out
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import javax.swing.*;
import java.awt.*;
import java.util.Random;

public class Main
{
    public static void main (String[] args)
    {
        JFrame theGUI = new JFrame();
        theGUI.setTitle("Bulls-Eye");
        theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container pane = theGUI.getContentPane();
        // Set the drawing area to be 500 x 500
        pane.setPreferredSize(new Dimension(500, 500));        
        String inputStr = JOptionPane.showInputDialog("Number of ovals: ", "5");
        if (inputStr == null) return;
        int ovals = Integer.parseInt(inputStr);
        ColorPanel panel = new ColorPanel(Color.black, ovals);
        pane.add(panel);
        theGUI.pack();
        theGUI.setVisible(true);
    }
}