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 ArrestOptionPane {
        
        private JPanel OptionPanel = new javax.swing.JPanel();
        private JScrollPane OptionPane = new JScrollPane();

        public ArrestOptionPane(){
        }

        private JLabel wavelengthLabel = new javax.swing.JLabel();
        private JTextField wavelengthField = new javax.swing.JTextField();
        
        private JLabel ytransdownLabel = new javax.swing.JLabel();
        private JTextField ytransdownField = new javax.swing.JTextField();
        
        private JLabel ytransupLabel = new javax.swing.JLabel();
        private JTextField ytransupField = new javax.swing.JTextField();
        
        private JLabel xtransdownLabel = new javax.swing.JLabel();
        private JTextField xtransdownField = new javax.swing.JTextField();

        private JLabel xtransupLabel = new javax.swing.JLabel();
        private JTextField xtransupField = new javax.swing.JTextField();

        private JLabel waverepLabel = new javax.swing.JLabel();
        private JTextField waverepField = new javax.swing.JTextField();
        
        private JLabel wavedepthLabel = new javax.swing.JLabel();
        private JTextField wavedepthField = new javax.swing.JTextField();
        
        private JLabel wavewidthLabel = new javax.swing.JLabel();
        private JTextField wavewidthField = new javax.swing.JTextField();
        
        private JLabel lineQuantityLabel = new javax.swing.JLabel();
        private JTextField lineQuantityField = new javax.swing.JTextField();

        private JButton DrawButton = new javax.swing.JButton();
        private JSlider wavelengthSlider = new javax.swing.JSlider();
        private JSlider ytransupSlider = new javax.swing.JSlider();
        private JSlider xtransupSlider = new javax.swing.JSlider();
        private JSlider ytransdownSlider = new javax.swing.JSlider();
        private JSlider xtransdownSlider = new javax.swing.JSlider();
        private JSlider waverepSlider = new javax.swing.JSlider();
        private JSlider wavedepthSlider = new javax.swing.JSlider();
        private JSlider wavewidthSlider = new javax.swing.JSlider();
        private JSlider lineQuantitySlider = new javax.swing.JSlider();

        public JScrollPane arrestPaneLoad(){

        OptionPanel.setBackground(new java.awt.Color(153, 153, 255));
        OptionPanel.setBorder(new javax.swing.border.EtchedBorder());
        OptionPanel.setPreferredSize(new java.awt.Dimension(200, 780));
        wavelengthLabel.setText("Wavelength");
        wavelengthLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(wavelengthLabel, java.awt.BorderLayout.CENTER);

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

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

        ytransdownLabel.setText("Y Offset to turn");
        ytransdownLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(ytransdownLabel, java.awt.BorderLayout.CENTER);

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

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


        ytransupLabel.setText("Y Offset after turn");
        ytransupLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(ytransupLabel, java.awt.BorderLayout.CENTER);

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

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

        xtransdownLabel.setText("X Offset to turn");
        xtransdownLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(xtransdownLabel, java.awt.BorderLayout.CENTER);

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

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

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

        xtransupLabel.setText("X Offset after turn");
        xtransupLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(xtransupLabel, java.awt.BorderLayout.CENTER);

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

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

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

        waverepLabel.setText("Repitions");
        waverepLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(waverepLabel, java.awt.BorderLayout.CENTER);

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

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

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

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

        wavedepthLabel.setText("WaveDepth");
        wavedepthLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(wavedepthLabel, java.awt.BorderLayout.CENTER);

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

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

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

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

        wavewidthLabel.setText("Wave Width");
        wavewidthLabel.setPreferredSize(new java.awt.Dimension(150, 20));
        OptionPanel.add(wavewidthLabel, java.awt.BorderLayout.CENTER);

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

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

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

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

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

        lineQuantitySlider.setBackground(new java.awt.Color(153, 153, 255));
        lineQuantitySlider.setForeground(new java.awt.Color(0, 51, 51));
        lineQuantitySlider.setMajorTickSpacing(10);
        lineQuantitySlider.setPaintLabels(true);
        lineQuantitySlider.setPaintTicks(true);
        lineQuantitySlider.setMaximum(50);
        lineQuantitySlider.setMinimum(0);
        lineQuantitySlider.setValue(25);
        lineQuantitySlider.setPreferredSize(new java.awt.Dimension(180, 50));
        lineQuantitySlider.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
                lineQuantitySliderMouseReleased(evt);
                }
        });
        OptionPanel.add(lineQuantitySlider, 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.Arrest.doDraw(Integer.parseInt(wavelengthField.getText()),
					Integer.parseInt(ytransupField.getText()),
        				Integer.parseInt(xtransupField.getText()),
        				Integer.parseInt(ytransdownField.getText()),
        				Integer.parseInt(xtransdownField.getText()),
        				Integer.parseInt(waverepField.getText()),
        				Integer.parseInt(wavedepthField.getText()),
        				Integer.parseInt(lineQuantityField.getText()),
        				Integer.parseInt(wavewidthField.getText())));

    }

    private void DrawButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DrawButtonActionPerformed
        Draw();
    }//GEN-LAST:event_DrawButtonActionPerformed


    private void wavelengthSliderMouseReleased(MouseEvent evt) {
               wavelengthField.setText(Integer.toString(wavelengthSlider.getValue()));
               Draw();
    }

    private void ytransupSliderMouseReleased(MouseEvent evt) {
               ytransupField.setText(Integer.toString(ytransupSlider.getValue()));
               Draw();
    }

    private void xtransupSliderMouseReleased(MouseEvent evt) {
               xtransupField.setText(Integer.toString(xtransupSlider.getValue()));
               Draw();
    }

    private void ytransdownSliderMouseReleased(MouseEvent evt) {
               ytransdownField.setText(Integer.toString(ytransdownSlider.getValue()));
               Draw();
    }

    private void xtransdownSliderMouseReleased(MouseEvent evt) {
               xtransdownField.setText(Integer.toString(xtransdownSlider.getValue()));
               Draw();
    }

    private void waverepSliderMouseReleased(MouseEvent evt) {
               waverepField.setText(Integer.toString(waverepSlider.getValue()));
               Draw();
    }

    private void wavedepthSliderMouseReleased(MouseEvent evt) {
               wavedepthField.setText(Integer.toString(wavedepthSlider.getValue()));
               Draw();
    }

    private void wavewidthSliderMouseReleased(MouseEvent evt) {
               wavewidthField.setText(Integer.toString(wavewidthSlider.getValue()));
               Draw();
    }
    
    private void lineQuantitySliderMouseReleased(MouseEvent evt) {
               lineQuantityField.setText(Integer.toString(lineQuantitySlider.getValue()));
               Draw();
    }

}
