/*
 * AttractLoop.java
 *
 * Created on July 10, 2003, 1:50 PM
 */

package PER.exhibit.GUI;

/**
 *
 * @author  Rachel Gockley
 */
public class AttractLoop extends javax.swing.JPanel implements Screen {
    
    /** Creates new form AttractLoop */
    public AttractLoop() {
        initComponents();
//        image1.setBounds(0, 0, 1024, 768);
        image4.setBounds(0, 0, 1024, 768);
        image5.setBounds(0, 0, 1024, 768);
        image6.setBounds(0, 0, 1024, 768);
        
//        image1_animation.setBounds(0, 0, 1024, 768);
        //image4_animation.setBounds(49, 174, 941, 317);
        image4_animation.setBounds(52, 174, 941, 317);
        image5_animation.setBounds(77, 259, 563, 306);
        image6_animation.setBounds(217, 216, 533, 350);
        
        loopTimer = new javax.swing.Timer(6000, new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ((java.awt.CardLayout)imagePanel.getLayout()).next(imagePanel);
            }
        });
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {//GEN-BEGIN:initComponents
        imagePanel = new javax.swing.JPanel();
        image2 = new javax.swing.JLabel();
        image3 = new javax.swing.JLabel();
        image4_pane = new javax.swing.JLayeredPane();
        image4 = new javax.swing.JLabel();
        image4_animation = new javax.swing.JLabel();
        image5_pane = new javax.swing.JLayeredPane();
        image5 = new javax.swing.JLabel();
        image5_animation = new javax.swing.JLabel();
        image6_pane = new javax.swing.JLayeredPane();
        image6 = new javax.swing.JLabel();
        image6_animation = new javax.swing.JLabel();

        setLayout(new java.awt.BorderLayout());

        imagePanel.setLayout(new java.awt.CardLayout());

        imagePanel.setPreferredSize(new java.awt.Dimension(1024, 688));
        image2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/2_TheRoverCanHelpYou.jpg")));
        imagePanel.add(image2, "image2");

        image3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/3_GiveTheRoverPath.jpg")));
        imagePanel.add(image3, "image3");

        image4_pane.setAlignmentX(0.0F);
        image4_pane.setMaximumSize(new java.awt.Dimension(1024, 768));
        image4_pane.setMinimumSize(new java.awt.Dimension(1024, 768));
        image4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/4_FirstPickDirection.jpg")));
        image4.setBounds(0, 0, -1, -1);
        image4_pane.add(image4, javax.swing.JLayeredPane.DEFAULT_LAYER);

        image4_animation.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/PanoramaAnimation.gif")));
        image4_animation.setBounds(0, 0, -1, -1);
        image4_pane.add(image4_animation, javax.swing.JLayeredPane.MODAL_LAYER);

        imagePanel.add(image4_pane, "image4");

        image5_pane.setAlignmentX(0.0F);
        image5_pane.setMaximumSize(new java.awt.Dimension(1024, 768));
        image5_pane.setMinimumSize(new java.awt.Dimension(1024, 768));
        image5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/5_ThenSpecDistance.jpg")));
        image5.setBounds(0, 0, -1, -1);
        image5_pane.add(image5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        image5_animation.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/DistanceAnimation.gif")));
        image5_animation.setBounds(0, 0, -1, -1);
        image5_pane.add(image5_animation, javax.swing.JLayeredPane.MODAL_LAYER);

        imagePanel.add(image5_pane, "image5");

        image6_pane.setAlignmentX(0.0F);
        image6_pane.setMaximumSize(new java.awt.Dimension(1024, 768));
        image6_pane.setMinimumSize(new java.awt.Dimension(1024, 768));
        image6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/6_CheckForSigns.jpg")));
        image6.setBounds(0, 0, -1, -1);
        image6_pane.add(image6, javax.swing.JLayeredPane.DEFAULT_LAYER);

        image6_animation.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PER/exhibit/GUI/images/RockGlowAni.gif")));
        image6_animation.setBounds(0, 0, -1, -1);
        image6_pane.add(image6_animation, javax.swing.JLayeredPane.MODAL_LAYER);

        imagePanel.add(image6_pane, "image5");

        add(imagePanel, java.awt.BorderLayout.CENTER);

    }//GEN-END:initComponents

    public void start() {
        PER.rover.StatsLog.println(PER.rover.StatsLog.START_ATTRACT);
        ((java.awt.CardLayout)imagePanel.getLayout()).show(imagePanel, "image1");
        loopTimer.start();
        
    }
    
    public void stop() {
        PER.rover.StatsLog.println(PER.rover.StatsLog.STOP_ATTRACT);
        loopTimer.stop();
    }

    public static void main(String args[]) {
        javax.swing.JFrame f = new javax.swing.JFrame();
        f.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                System.exit(0);
            }
        });
        
        AttractLoop panel = new AttractLoop();
        f.getContentPane().add(panel);
        f.setResizable(false);
        f.setUndecorated(true);
        f.pack();
        
        panel.start();
        
        java.awt.GraphicsDevice device = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        boolean isFullScreen = device.isFullScreenSupported();
        if (isFullScreen) {
            // Full-screen mode
            device.setFullScreenWindow(f);
            f.validate();
        } else {
            // Windowed mode
            f.show();
        
        }
        
        panel.stop();
        
    }

    public void setClockTime(String s) {
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel image2;
    private javax.swing.JLabel image3;
    private javax.swing.JLabel image4;
    private javax.swing.JLabel image4_animation;
    private javax.swing.JLayeredPane image4_pane;
    private javax.swing.JLabel image5;
    private javax.swing.JLabel image5_animation;
    private javax.swing.JLayeredPane image5_pane;
    private javax.swing.JLabel image6;
    private javax.swing.JLabel image6_animation;
    private javax.swing.JLayeredPane image6_pane;
    private javax.swing.JPanel imagePanel;
    // End of variables declaration//GEN-END:variables
    
    private javax.swing.Timer loopTimer;
}
