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 ImageWizard extends JPanel{

        private JPanel step1Panel = new javax.swing.JPanel();
        //private JPanel previewPanel = new javax.swing.JPanel();
        private JScrollPane step2Pane = new JScrollPane();
        //private JTabbedPane jtp = new JTabbedPane();
        private JComboBox imageComboBox = new javax.swing.JComboBox();
        private JButton selectButton = new JButton("Select Image Type");
        private JButton finishButton = new JButton("Set Parameters and Finish");
        private PanelLoader panelLoader = new PanelLoader();

        private String imagetype;
        private int imagecase;

        public ImageWizard() {
               createUI();
        }

        private void createUI() {

               setSize(400,300);
               selectButton.addMouseListener(new java.awt.event.MouseAdapter() {
               public void mouseReleased(java.awt.event.MouseEvent e){
                        if(imageComboBox.getSelectedItem()!=null){
                                imagetype = (String)imageComboBox.getSelectedItem();
                                imageCaseChecker();
                        }
                        }
               });
               
               imageComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Cataract", "Brittania", "Fall", "Crest", "Accident", "Arrest", "Ellipse", "Ellipse2", "Rect", "Rect2", "Orient", "Pause", "Entice" }));

               step1Panel.add(imageComboBox);
               step1Panel.add(selectButton);
               add(step1Panel);
               add(finishButton);
               step2Pane.setVisible(false);
               add(step2Pane);
        }
        
        public void imageCaseChecker(){
        if (imagetype.equals ("Cataract")) {imagecase = 1;}
	if (imagetype.equals ("Fall")) {imagecase = 2;}
	if (imagetype.equals ("Brittania")) {imagecase = 3;}
	if (imagetype.equals ("Rect")) {imagecase = 4;}
	if (imagetype.equals ("Rect2")) {imagecase = 5;}
	if (imagetype.equals ("Ellipse")) {imagecase = 6;}
	if (imagetype.equals ("Ellipse2")) {imagecase = 7;}
	if (imagetype.equals ("Accident")) {imagecase = 8;}
	if (imagetype.equals ("Crest")) {imagecase = 9;}
	if (imagetype.equals ("Arrest")) {imagecase = 10;}
	if (imagetype.equals ("Orient")) {imagecase = 11;}
	if (imagetype.equals ("Pause")) {imagecase = 12;}
	//if (imagetype.equals ("Entice")) {imagecase = 13;}
	doShow();
       }





        public void doShow() {
        switch (imagecase){
               case 1:     step1Panel.setVisible(false);
                           step2Pane.setVisible(false);
                           step2Pane = panelLoader.cataractPanelLoad();
                           step2Pane.setVisible(true);
                           break;
               case 2:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.fallPanelLoad();
                           step2Pane.show();
                           break;
               case 3:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.brittaniaPanelLoad();
                           step2Pane.show();
                           break;
               case 4:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.rectPanelLoad();
                           step2Pane.show();
                           break;
               case 5:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.rect2PanelLoad();
                           step2Pane.show();
                           break;
               case 6:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.ellipsePanelLoad();
                           step2Pane.show();
                           break;
               case 7:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.ellipse2PanelLoad();
                           step2Pane.show();
                           break;
               case 8:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.accidentPanelLoad();
                           step2Pane.show();
                           break;
               case 9:     step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.crestPanelLoad();
                           step2Pane.show();
                           break;
               case 10:    step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.arrestPanelLoad();
                           step2Pane.show();
                           break;
               case 11:    step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.orientPanelLoad();
                           step2Pane.show();
                           break;
               case 12:    step1Panel.hide();
                           step2Pane.hide();
                           step2Pane = panelLoader.pausePanelLoad();
                           step2Pane.show();
                           break;
//               case 13:    step1Panel.hide();
                        //   break;
               default:    break;
        }
    }

}
