import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class CookieJarJPanel extends JPanel
{
public void paintComponent (Graphics g)
{
super.paintComponent (g);
Graphics2D g2d = (Graphics2D ) g;
g.setColor (new Color (169, 39, 19));
g.fillRect (0, 600, 900, 450); //Table
//Jar
g.setColor(Color.BLACK);
g.drawOval (325, 300, 250, 50);
g.drawLine (325, 325, 375, 400);
g.drawLine (575, 325, 525, 400);
g.drawLine (375, 400, 325, 500);
g.drawLine (525, 400, 575, 500);
g.drawLine (325, 500, 375, 650);
g.drawLine (575, 500, 525, 650);
g.drawOval (375, 625, 150, 50);
g.drawArc (375, 375, 150, 50, 0, -180);
//Plates
g.setColor (Color.WHITE);
g.fillOval (25, 625, 250, 100); //Left Plate
g.fillOval (625 ,625, 250, 100); //Right Plate
g.setColor (Color.BLACK);
g.drawOval (50, 640, 200, 65);
g.drawOval (650, 640, 200, 65);
//Cookies (12)
g.setColor (new Color(205, 133, 63));
g.fillOval (340, 500, 50, 50);
g.fillOval (350, 525, 50, 50);
g.fillOval (380, 550, 50, 50);
g.fillOval (405, 490, 50, 50);
g.fillOval (415, 520, 50, 50);
g.fillOval (370, 600, 50, 50);
g.fillOval (400, 615, 50, 50);
g.fillOval (450, 610, 50, 50);
g.fillOval (500, 525, 50, 50);
g.fillOval (450, 550, 50, 50);
g.fillOval (475, 575, 50, 50);
g.fillOval (400, 575, 50, 50);
}
ImageIcon icon1;
JTextArea text;
JCheckBox checkBox;
JComboBox number;
Container container;
FlowLayout layout;
public CookieJarJPanel()
{
layout = new FlowLayout();
setLayout(layout);
JButton noranEat, johnEat;
JTextArea noranName, johnName, noranCount, johnCount, cookieTotal;
int noranCookieCount, johnCookieCount, cookieTotalCount;
noranCookieCount = 12;
johnCookieCount = 4;
cookieTotalCount = 2;
noranEat = new JButton ("Have Noran take a cookie");
johnEat = new JButton ("Have John take a cookie");
noranName = new JTextArea ("Noran's Amout: ");
johnName = new JTextArea ("John's Amount: ");
//noranCount = new JTextArea (noranCookieCount);
//johnCount = new JTextArea (johnCookieCount);
//cookieTotal = new JTextArea (cookieTotalCount);
noranEat.setBounds (25,25, 50, 50);
add(noranEat);
add(noranName);
add(johnEat);
add(johnName);
//add(noranCount);
//add(johnCount);
//add(cookieTotal);
}
}