import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.imageio.*;
import java.io.*;

/**
 *  CoinConverter shows us how many of which coins you need to give
 * for a given change.
 *
 * @author name 1:                    discussion section time:
 * @author name 2:                    discussion section time:
 * @date:
 *
 * Extra Credit Attempted (YES/NO):
 */
public class CoinConverter implements ActionListener {

    // constants
    // screen dimensions
    private static final int WINDOW_WIDTH  = 1000;  //pixels
    private static final int WINDOW_HEIGHT = 600;   //pixels
    private static final int TEXT_WIDTH    = 20;  // characters

    private static final String QUESTION = "\n   How many cents do you want to convert?\n";

    // instance variables
    // Make a window with a title - just one ever
    private JFrame window;

    // panel for the question and the button
    private JPanel questionPanel;

    // question area
    private JTextArea questionArea;

    // user entry area for the amount
    private JLabel amountTag;
    private JTextField amountText;
    // Enter button
    private JButton enterButton;

     // use the FlowLayout for the picture Panel
    private JPanel picturePanel;

    /**
     * Constructor for objects of class CoinConverter
     *    configures the GUI
     */
    public CoinConverter()
    {

        // instance variables initialization
        // Make a window with a title - just one ever
        window = new JFrame("Coin Converter GUI");

        // Use a grid layout for the question and the button
        GridLayout aux = new GridLayout();
        aux.setColumns(3);
        questionPanel = new JPanel(aux);
        questionArea = new JTextArea(QUESTION, 2, TEXT_WIDTH);
        // user entry area for the amount
        amountTag = new JLabel ("Enter the amount in cents:");
        amountText = new JTextField(TEXT_WIDTH);
        // Enter button
        enterButton = new JButton("Enter");

        // register the listner
        enterButton.addActionListener(this);

        // window size and exit
        window.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        window.setLayout(new BorderLayout());
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // Lay all the pieces out
        questionPanel.add(questionArea);
        questionPanel.add(amountText);
        questionPanel.add(enterButton);

        window.add(questionPanel, BorderLayout.SOUTH);
        window.pack();
        // show the window after we have put in all the components
        // so the construction process is not visible to the user
        window.setVisible(true);
    }

    /**
     * event button handler code - this acts once the user selects the enter button
     *
     * @param  user event
     */
    public void actionPerformed (ActionEvent e)
    {
        //your code here
    }

    public static void main(String[] args) {
        CoinConverter cc = new CoinConverter();
    }
}
