/*
 * Main.java
 *
 * Created on 11 de Outubro de 2004, 11:06
 */

package locadora.main;

/**
 *
 * @author  Rafael
 */
import locadora.ui.*;
import locadora.core.*;
import locadora.factory.*;

public class Main extends javax.swing.JFrame {
    
    JEfetuarEmprestimo  efetuarEmprestimo;
    JCadastraVideo      cadastraVideo;    
    public static Factory factory;
    
    public Main() {
        initComponents();
        this.setSize(800,600);
        factory = new Factory(Main.class);
        cadastraVideo = new JCadastraVideo();
        efetuarEmprestimo = new JEfetuarEmprestimo();        
        
        desktopPane.add(cadastraVideo,javax.swing.JLayeredPane.DEFAULT_LAYER);
        desktopPane.add(efetuarEmprestimo,javax.swing.JLayeredPane.DEFAULT_LAYER);        
     //    fileMenu.setText("Arquivo");
    }
    
    /** 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
        desktopPane = new javax.swing.JDesktopPane();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        openMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        saveAsMenuItem = new javax.swing.JMenuItem();
        editMenu = new javax.swing.JMenu();
        cutMenuItem = new javax.swing.JMenuItem();
        copyMenuItem = new javax.swing.JMenuItem();
        pasteMenuItem = new javax.swing.JMenuItem();
        deleteMenuItem = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        helpMenu = new javax.swing.JMenu();
        contentMenuItem = new javax.swing.JMenuItem();
        aboutMenuItem = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().add(desktopPane, java.awt.BorderLayout.CENTER);

        fileMenu.setText("Arquivo");
        openMenuItem.setText("Filmes");
        fileMenu.add(openMenuItem);

        saveMenuItem.setText("Videos");
        saveMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveMenuItemActionPerformed(evt);
            }
        });

        fileMenu.add(saveMenuItem);

        saveAsMenuItem.setText("Clientes");
        fileMenu.add(saveAsMenuItem);

        menuBar.add(fileMenu);

        editMenu.setText("Opera\u00e7\u00f5es");
        cutMenuItem.setText("Realizar Empr\u00e9stimo");
        cutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cutMenuItemActionPerformed(evt);
            }
        });

        editMenu.add(cutMenuItem);

        copyMenuItem.setText("Efetuar Devolu\u00e7\u00e3o");
        editMenu.add(copyMenuItem);

        pasteMenuItem.setText("Paste");
        editMenu.add(pasteMenuItem);

        deleteMenuItem.setText("Delete");
        editMenu.add(deleteMenuItem);

        menuBar.add(editMenu);

        jMenu2.setText("Relat\u00f3rios");
        menuBar.add(jMenu2);

        helpMenu.setText("Ajuda");
        contentMenuItem.setText("Conte\u00fado");
        helpMenu.add(contentMenuItem);

        aboutMenuItem.setText("Sobre");
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        jMenu1.setText("Sair");
        jMenu1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenu1ActionPerformed(evt);
            }
        });

        menuBar.add(jMenu1);

        setJMenuBar(menuBar);

        pack();
    }//GEN-END:initComponents

    private void cutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cutMenuItemActionPerformed
        efetuarEmprestimo.loadObject(new Emprestimo());
        efetuarEmprestimo.setVisible(true);
    }//GEN-LAST:event_cutMenuItemActionPerformed

    private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed
        System.exit(0);
    }//GEN-LAST:event_jMenu1ActionPerformed

    private void saveMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMenuItemActionPerformed
        cadastraVideo.loadObject(new Video());
        cadastraVideo.setVisible(true);
    }//GEN-LAST:event_saveMenuItemActionPerformed
        
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Main().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenuItem contentMenuItem;
    private javax.swing.JMenuItem copyMenuItem;
    private javax.swing.JMenuItem cutMenuItem;
    private javax.swing.JMenuItem deleteMenuItem;
    private javax.swing.JDesktopPane desktopPane;
    private javax.swing.JMenu editMenu;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem openMenuItem;
    private javax.swing.JMenuItem pasteMenuItem;
    private javax.swing.JMenuItem saveAsMenuItem;
    private javax.swing.JMenuItem saveMenuItem;
    // End of variables declaration//GEN-END:variables
    
}
