package opartgui;
import java.awt.event.*;
import javax.swing.event.*;
import java.io.*;
import java.awt.geom.*;
import javax.swing.*;
import java.awt.*;


public class PauseOptionPane{

        private JPanel OptionPanel = new javax.swing.JPanel();
        private JScrollPane OptionPane = new JScrollPane();

        public PauseOptionPane(){

        }

        private JLabel changeOneLabel = new javax.swing.JLabel();
        private JTextField changeOneField = new javax.swing.JTextField();

        private JLabel changeTwoLabel = new javax.swing.JLabel();
        private JTextField changeTwoField = new javax.swing.JTextField();

        private JLabel changeThreeLabel = new javax.swing.JLabel();
        private JTextField changeThreeField = new javax.swing.JTextField();

        private JLabel circleQuantityLabel = new javax.swing.JLabel();
        private JTextField circleQuantityField = new javax.swing.JTextField();

        private JLabel circleSizeStartLabel = new javax.swing.JLabel();
        private JTextField circleSizeStartField = new javax.swing.JTextField();

        private JLabel changeFourLabel = new javax.swing.JLabel();
        private JTextField changeFourField = new javax.swing.JTextField();

        private JLabel turnaroundLabel = new javax.swing.JLabel();
        private JTextField turnaroundField = new javax.swing.JTextField();
        
        private JLabel colourChangeLabel = new javax.swing.JLabel();
        private JTextField colourChangeField = new javax.swing.JTextField();

        private JSlider changeOneSlider = new javax.swing.JSlider();
        private JSlider changeTwoSlider = new javax.swing.JSlider();
        private JSlider changeThreeSlider = new javax.swing.JSlider();
        private JSlider changeFourSlider = new javax.swing.JSlider();
        private JSlider circleSizeStartSlider = new javax.swing.JSlider();
        private JSlider circleQuantitySlider = new javax.swing.JSlider();
        private JSlider turnaroundSlider = new javax.swing.JSlider();
        private JSlider colourChangeSlider = new javax.swing.JSlider();
        private JButton DrawButton = new javax.swing.JButton();

        public JScrollPane pausePaneLoad(){

               OptionPanel.setBackground(new java.awt.Color(153, 153, 255));
               OptionPanel.setBorder(new javax.swing.border.EtchedBorder());
               OptionPanel.setPreferredSize(new java.awt.Dimension(200, 780));

               changeOneLabel.setText("Change One");
               changeOneLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(changeOneLabel, java.awt.BorderLayout.CENTER);

               changeOneField.setText("4");
               changeOneField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(changeOneField, java.awt.BorderLayout.CENTER);

               changeOneSlider.setBackground(new java.awt.Color(153, 153, 255));
               changeOneSlider.setForeground(new java.awt.Color(0, 51, 51));
               changeOneSlider.setMajorTickSpacing(2);
               changeOneSlider.setPaintLabels(true);
               changeOneSlider.setPaintTicks(true);
               changeOneSlider.setMaximum(8);
               changeOneSlider.setMinimum(0);
               changeOneSlider.setValue(4);
               changeOneSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               changeOneSlider.addMouseListener(new MouseAdapter() {
               public void mouseReleased(MouseEvent evt) {
                      changeOneSliderMouseReleased(evt);
                      }
               });
               OptionPanel.add(changeOneSlider, java.awt.BorderLayout.CENTER);

               changeTwoLabel.setText("Change Two");
               changeTwoLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(changeTwoLabel, java.awt.BorderLayout.CENTER);

               changeTwoField.setText("2");
               changeTwoField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(changeTwoField, java.awt.BorderLayout.CENTER);

               changeTwoSlider.setBackground(new java.awt.Color(153, 153, 255));
               changeTwoSlider.setForeground(new java.awt.Color(0, 51, 51));
               changeTwoSlider.setMajorTickSpacing(2);
               changeTwoSlider.setPaintLabels(true);
               changeTwoSlider.setPaintTicks(true);
               changeTwoSlider.setMaximum(8);
               changeTwoSlider.setMinimum(0);
               changeTwoSlider.setValue(2);
               changeTwoSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               changeTwoSlider.addMouseListener(new MouseAdapter() {
               public void mouseReleased(MouseEvent evt) {
                      changeTwoSliderMouseReleased(evt);
                      }
               });
               OptionPanel.add(changeTwoSlider, java.awt.BorderLayout.CENTER);

               changeThreeLabel.setText("Change Three");
               changeThreeLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(changeThreeLabel, java.awt.BorderLayout.CENTER);

               changeThreeField.setText("1");
               changeThreeField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(changeThreeField, java.awt.BorderLayout.CENTER);

               changeThreeSlider.setBackground(new java.awt.Color(153, 153, 255));
               changeThreeSlider.setForeground(new java.awt.Color(0, 51, 51));
               changeThreeSlider.setMajorTickSpacing(2);
               changeThreeSlider.setPaintLabels(true);
               changeThreeSlider.setPaintTicks(true);
               changeThreeSlider.setMaximum(8);
               changeThreeSlider.setMinimum(0);
               changeThreeSlider.setValue(1);
               changeThreeSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               changeThreeSlider.addMouseListener(new MouseAdapter() {
               public void mouseReleased(MouseEvent evt) {
                      changeThreeSliderMouseReleased(evt);
                      }
               });
               OptionPanel.add(changeThreeSlider, java.awt.BorderLayout.CENTER);

               changeFourLabel.setText("Change Four");
               changeFourLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(changeFourLabel, java.awt.BorderLayout.CENTER);

               changeFourField.setText("1");
               changeFourField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(changeFourField, java.awt.BorderLayout.CENTER);

               changeFourSlider.setBackground(new java.awt.Color(153, 153, 255));
               changeFourSlider.setForeground(new java.awt.Color(0, 51, 51));
               changeFourSlider.setMajorTickSpacing(2);
               changeFourSlider.setPaintLabels(true);
               changeFourSlider.setPaintTicks(true);
               changeFourSlider.setMaximum(8);
               changeFourSlider.setMinimum(0);
               changeFourSlider.setValue(1);
               changeFourSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               changeFourSlider.addMouseListener(new MouseAdapter() {
               public void mouseReleased(MouseEvent evt) {
                      changeFourSliderMouseReleased(evt);
                      }
               });
               OptionPanel.add(changeFourSlider, java.awt.BorderLayout.CENTER);

               turnaroundLabel.setText("Turnaround Point");
               turnaroundLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(turnaroundLabel, java.awt.BorderLayout.CENTER);

               turnaroundField.setText("19");
               turnaroundField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(turnaroundField, java.awt.BorderLayout.CENTER);

               turnaroundSlider.setBackground(new java.awt.Color(153, 153, 255));
               turnaroundSlider.setForeground(new java.awt.Color(0, 51, 51));
               turnaroundSlider.setMajorTickSpacing(10);
               turnaroundSlider.setPaintLabels(true);
               turnaroundSlider.setPaintTicks(true);
               turnaroundSlider.setMaximum(40);
               turnaroundSlider.setMinimum(0);
               turnaroundSlider.setValue(19);
               turnaroundSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               turnaroundSlider.addMouseListener(new MouseAdapter() {

               public void mouseReleased(MouseEvent evt) {
                      turnaroundSliderMouseReleased(evt);
                      }
               });
               OptionPanel.add(turnaroundSlider, java.awt.BorderLayout.CENTER);

               colourChangeLabel.setText("Colour Change");
               colourChangeLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(colourChangeLabel, java.awt.BorderLayout.CENTER);

               colourChangeField.setText("20");
               colourChangeField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(colourChangeField, java.awt.BorderLayout.CENTER);

               colourChangeSlider.setBackground(new java.awt.Color(153, 153, 255));
               colourChangeSlider.setForeground(new java.awt.Color(0, 51, 51));
               colourChangeSlider.setMajorTickSpacing(5);
               colourChangeSlider.setPaintLabels(true);
               colourChangeSlider.setPaintTicks(true);
               colourChangeSlider.setMaximum(25);
               colourChangeSlider.setMinimum(0);
               colourChangeSlider.setValue(20);
               colourChangeSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               colourChangeSlider.addMouseListener(new MouseAdapter() {

               public void mouseReleased(MouseEvent evt) {
                      colourChangeSliderMouseReleased(evt);
                      }
               });
               OptionPanel.add(colourChangeSlider, java.awt.BorderLayout.CENTER);

               circleQuantityLabel.setText("Circle Quantity");
               circleQuantityLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(circleQuantityLabel, java.awt.BorderLayout.CENTER);

               circleQuantityField.setText("15");
               circleQuantityField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(circleQuantityField, java.awt.BorderLayout.CENTER);

               circleQuantitySlider.setBackground(new java.awt.Color(153, 153, 255));
               circleQuantitySlider.setForeground(new java.awt.Color(0, 51, 51));
               circleQuantitySlider.setMajorTickSpacing(5);
               circleQuantitySlider.setPaintLabels(true);
               circleQuantitySlider.setPaintTicks(true);
               circleQuantitySlider.setMaximum(30);
               circleQuantitySlider.setMinimum(0);
               circleQuantitySlider.setValue(15);
               circleQuantitySlider.setPreferredSize(new java.awt.Dimension(180, 50));
               circleQuantitySlider.addMouseListener(new MouseAdapter() {

               public void mouseReleased(MouseEvent evt) {
                      circleQuantitySliderMouseReleased(evt);
                      }
               });

               OptionPanel.add(circleQuantitySlider, java.awt.BorderLayout.CENTER);

               circleSizeStartLabel.setText("Initial Circle Size");
               circleSizeStartLabel.setPreferredSize(new java.awt.Dimension(150, 20));
               OptionPanel.add(circleSizeStartLabel, java.awt.BorderLayout.CENTER);

               circleSizeStartField.setText("30");
               circleSizeStartField.setPreferredSize(new java.awt.Dimension(30, 20));
               OptionPanel.add(circleSizeStartField, java.awt.BorderLayout.CENTER);

               circleSizeStartSlider.setBackground(new java.awt.Color(153, 153, 255));
               circleSizeStartSlider.setForeground(new java.awt.Color(0, 51, 51));
               circleSizeStartSlider.setMajorTickSpacing(10);
               circleSizeStartSlider.setPaintLabels(true);
               circleSizeStartSlider.setPaintTicks(true);
               circleSizeStartSlider.setMaximum(50);
               circleSizeStartSlider.setMinimum(0);
               circleSizeStartSlider.setValue(30);
               circleSizeStartSlider.setPreferredSize(new java.awt.Dimension(180, 50));
               circleSizeStartSlider.addMouseListener(new MouseAdapter() {

               public void mouseReleased(MouseEvent evt) {
                      circleSizeStartSliderMouseReleased(evt);
                      }
               });

               OptionPanel.add(circleSizeStartSlider, java.awt.BorderLayout.CENTER);

               DrawButton.setBackground(new java.awt.Color(102, 102, 255));
               DrawButton.setText("Draw");
               DrawButton.setPreferredSize(new java.awt.Dimension(100, 20));
               DrawButton.addActionListener(new java.awt.event.ActionListener() {

               public void actionPerformed(java.awt.event.ActionEvent evt) {
                      DrawButtonActionPerformed(evt);
                      }
               });

               OptionPanel.add(DrawButton, java.awt.BorderLayout.CENTER);

               OptionPane.setViewportView(OptionPanel);
               return OptionPane;
        }

        public void Draw(){
                opart1.imagePanel.doDisplay(opart1.Pause.doDraw(Integer.parseInt(changeOneField.getText()),
		Integer.parseInt(changeTwoField.getText()),
                Integer.parseInt(changeThreeField.getText()),
                Integer.parseInt(changeFourField.getText()),
                Integer.parseInt(circleSizeStartField.getText()),
        	Integer.parseInt(circleQuantityField.getText()),
                Integer.parseInt(turnaroundField.getText()),
                Integer.parseInt(colourChangeField.getText())));
        }

        private void DrawButtonActionPerformed(java.awt.event.ActionEvent evt) {
                Draw();
        }

        private void changeOneSliderMouseReleased(MouseEvent evt) {
               changeOneField.setText(Integer.toString(changeOneSlider.getValue()));
               Draw();
        }

        private void changeTwoSliderMouseReleased(MouseEvent evt) {
               changeTwoField.setText(Integer.toString(changeTwoSlider.getValue()));
               Draw();
        }

        private void changeThreeSliderMouseReleased(MouseEvent evt) {
               changeThreeField.setText(Integer.toString(changeThreeSlider.getValue()));
               Draw();
        }

        private void changeFourSliderMouseReleased(MouseEvent evt) {
               changeFourField.setText(Integer.toString(changeFourSlider.getValue()));
               Draw();
        }

        private void turnaroundSliderMouseReleased(MouseEvent evt) {
               turnaroundField.setText(Integer.toString(turnaroundSlider.getValue()));
               Draw();
        }

        private void circleSizeStartSliderMouseReleased(MouseEvent evt) {
               circleSizeStartField.setText(Integer.toString(circleSizeStartSlider.getValue()));
               Draw();
        }

        private void circleQuantitySliderMouseReleased(MouseEvent evt) {
               circleQuantityField.setText(Integer.toString(circleQuantitySlider.getValue()));
               Draw();
        }
        
        private void colourChangeSliderMouseReleased(MouseEvent evt) {
               colourChangeField.setText(Integer.toString(colourChangeSlider.getValue()));
               Draw();
        }

}
