frm menu utama

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package andicki;

import Class.classkoneksi;
import nmMaster.ListBuku;
import nmMaster.ListDistributor;
import nmMaster.ListKasir;
import Laporan.*;
import java.awt.Cursor;
import nmFile.*;
import nmTransaksi.*;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Graphics;
import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JRootPane;
import javax.swing.plaf.PanelUI;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.view.JasperViewer;
import sesion.sessionLogin;

/**
 *
 * @author andicki
 */
public class frmMenuUtama extends javax.swing.JFrame {
sessionLogin sesi = new sessionLogin();
    /**
     * Creates new form frmMenuUtama
     */
    public frmMenuUtama() {
       
        setUndecorated(true);
        getRootPane().setWindowDecorationStyle(JRootPane.NONE);
        initComponents();
        PanelMenu.setUI(new BgSplash());
        this.setLocationRelativeTo(this);
       
    }
   
    private void cetakListBuku(){
        {setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        Connection cn = classkoneksi.setKoneksi();
        try {
        cn.createStatement();
        Map<String, Object> prs = new HashMap<String, Object>();
        JasperReport JRpt =
        JasperCompileManager.compileReport("src/Laporan/daftarBuku.jrxml");
        JasperPrint JPrint = JasperFillManager.fillReport(JRpt, prs, cn);
        JasperViewer view = new JasperViewer(JPrint, false);
        javax.swing.JDialog dialog = new javax.swing.JDialog(new javax.swing.JFrame(),true);//the owner
            dialog.setContentPane(view.getContentPane());
            dialog.setSize(1280,720);
            dialog.setTitle("List Buku");
            dialog.setLocationRelativeTo(this);
            dialog.setVisible(true);
           
        } catch (Exception rptexcpt) {
        System.out.println("Report Can't view because : " + rptexcpt);
        }
        setCursor(Cursor.getDefaultCursor());
        }
    }

   
     private void cetakListDistributor(){
        {setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        Connection cn = classkoneksi.setKoneksi();
        try {
        cn.createStatement();
        Map<String, Object> prs = new HashMap<String, Object>();
        JasperReport JRpt =
        JasperCompileManager.compileReport("src/Laporan/daftarDistributor.jrxml");
        JasperPrint JPrint = JasperFillManager.fillReport(JRpt, prs, cn);
        JasperViewer view = new JasperViewer(JPrint, false);
        javax.swing.JDialog dialog = new javax.swing.JDialog(new javax.swing.JFrame(),true);//the owner
            dialog.setContentPane(view.getContentPane());
            dialog.setSize(1280,720);
            dialog.setTitle("List Distributor");
            dialog.setLocationRelativeTo(this);
            dialog.setVisible(true);
           
        } catch (Exception rptexcpt) {
        System.out.println("Report Can't view because : " + rptexcpt);
        }
        setCursor(Cursor.getDefaultCursor());
        }
    }
   
   
    private void cetakListKasir(){
        {setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        Connection cn = classkoneksi.setKoneksi();
        try {
        cn.createStatement();
        Map<String, Object> prs = new HashMap<String, Object>();
        JasperReport JRpt =
        JasperCompileManager.compileReport("src/Laporan/daftarKasir.jrxml");
        JasperPrint JPrint = JasperFillManager.fillReport(JRpt, prs, cn);
        JasperViewer view = new JasperViewer(JPrint, false);
        javax.swing.JDialog dialog = new javax.swing.JDialog(new javax.swing.JFrame(),true);//the owner
            dialog.setContentPane(view.getContentPane());
            dialog.setSize(1280,720);
            dialog.setTitle("List Distributor");
            dialog.setLocationRelativeTo(this);
            dialog.setVisible(true);
           
        } catch (Exception rptexcpt) {
        System.out.println("Report Can't view because : " + rptexcpt);
        }
        setCursor(Cursor.getDefaultCursor());
        }
    }
   
   
   
     public void bersih(){
txtNama.setText("");
     }
   
   
   
    /**
     * 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.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                         
    private void initComponents() {

        PanelMenu = new javax.swing.JPanel();
        panel = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtNama = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        lock = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        mnBuku = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem14 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jLabel1.setText("Nama");

        javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel);
        panel.setLayout(panelLayout);
        panelLayout.setHorizontalGroup(
            panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtNama, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE)
                .addContainerGap())
        );
        panelLayout.setVerticalGroup(
            panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtNama, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout PanelMenuLayout = new javax.swing.GroupLayout(PanelMenu);
        PanelMenu.setLayout(PanelMenuLayout);
        PanelMenuLayout.setHorizontalGroup(
            PanelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelMenuLayout.createSequentialGroup()
                .addContainerGap(1709, Short.MAX_VALUE)
                .addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        PanelMenuLayout.setVerticalGroup(
            PanelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelMenuLayout.createSequentialGroup()
                .addContainerGap(1150, Short.MAX_VALUE)
                .addComponent(panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jMenu1.setText("File");
        jMenu1.add(jSeparator1);

        lock.setBackground(new java.awt.Color(255, 255, 255));
        lock.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/1484901179_lock.png"))); // NOI18N
        lock.setText("Lock");
        lock.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lockActionPerformed(evt);
            }
        });
        jMenu1.add(lock);
        jMenu1.add(jSeparator2);

        jMenuItem4.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/1484900642_logout.png"))); // NOI18N
        jMenuItem4.setText("Signout");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem4);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Master");

        mnBuku.setBackground(new java.awt.Color(255, 255, 255));
        mnBuku.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/buku.png"))); // NOI18N
        mnBuku.setText("Buku");
        mnBuku.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnBukuActionPerformed(evt);
            }
        });
        jMenu2.add(mnBuku);

        jMenuItem6.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/distributor.png"))); // NOI18N
        jMenuItem6.setText("Distributor");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem6);

        jMenuItem7.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/kasir.png"))); // NOI18N
        jMenuItem7.setText("Kasir");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem7);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Transaksi");

        jMenuItem8.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/pasok.png"))); // NOI18N
        jMenuItem8.setText("Pasok");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem8);

        jMenuItem9.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/penjualan.png"))); // NOI18N
        jMenuItem9.setText("Penjualan");
        jMenuItem9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem9ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem9);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Laporan");

        jMenuItem10.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/daftar distributor.png"))); // NOI18N
        jMenuItem10.setText("Daftar Distributor");
        jMenuItem10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem10ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem10);

        jMenuItem11.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/daftar buku.png"))); // NOI18N
        jMenuItem11.setText("Daftar Buku");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem11);

        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/kasir.png"))); // NOI18N
        jMenuItem2.setText("Daftar Kasir");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem2);
        jMenu4.add(jSeparator3);

        jMenuItem12.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/pasokan per periode.png"))); // NOI18N
        jMenuItem12.setText("Pasokan per Periode");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem12);

        jMenuItem13.setBackground(new java.awt.Color(255, 255, 255));
        jMenuItem13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/penjualan per periode.png"))); // NOI18N
        jMenuItem13.setText("Buku per Periode");
        jMenuItem13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem13ActionPerformed(evt);
            }
        });
        jMenu4.add(jMenuItem13);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("Help");

        jMenuItem14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/help.png"))); // NOI18N
        jMenuItem14.setText("Cara Penggunaan");
        jMenu5.add(jMenuItem14);

        jMenuItem15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/gambar/about.png"))); // NOI18N
        jMenuItem15.setText("Tentang Pembuat");
        jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem15ActionPerformed(evt);
            }
        });
        jMenu5.add(jMenuItem15);

        jMenuBar1.add(jMenu5);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PanelMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(PanelMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>                       

    private void mnBukuActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
         new ListBuku().setVisible(true);
    }                                     

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        new ListDistributor().setVisible(true);
    }                                         

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        new ListKasir().setVisible(true);
    }                                         

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
         new DaftarPasok().setVisible(true);
       
      
    }                                         

    private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
         new DaftarPenjualan().setVisible(true);
       
    }                                         

    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                 
        // TODO add your handling code here:
       
       
       
        log_in login = new log_in(new javax.swing.JFrame(),true);
        login.setVisible(true);
        login.setLocationRelativeTo(this);
       
       
         txtNama.setText(sesi.getNamaKasir());
       
       
    }                                

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        bersih();
       
          log_in login = new log_in(new javax.swing.JFrame(),true);
        login.setVisible(true);
        login.setLocationRelativeTo(this);
        txtNama.setText(sesi.getNamaKasir());
       
    }                                         

    private void lockActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        Lock lock = new Lock(new javax.swing.JFrame(), true);
         lock.setVisible(true);
        lock.setLocationRelativeTo(this);
    }                                   

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        LaporanPerPeriode print = new LaporanPerPeriode(new javax.swing.JFrame(),true);
        print.setStatus("Pasok");
        print.setTitle("Daftar Pasok");
        print.setVisible(true);
        print.setLocationRelativeTo(this);
    }                                          

    private void jMenuItem13ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        LaporanPerPeriode print = new LaporanPerPeriode(new javax.swing.JFrame(),true);
        print.setStatus("Buku");
        print.setTitle("Daftar Penjualan");
        print.setVisible(true);
        print.setLocationRelativeTo(this);
    }                                          

    private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        cetakListDistributor();
      
    }                                          

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        cetakListBuku();
    }                                          

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        cetakListKasir();
    }                                         

    private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        new tentangPembuat().setVisible(true);
    }                                          

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmMenuUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmMenuUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmMenuUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmMenuUtama.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
               new frmMenuUtama();
               frmMenuUtama nm = new frmMenuUtama();
               nm.setExtendedState(JFrame.MAXIMIZED_BOTH);
                nm.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                    
    private javax.swing.JPanel PanelMenu;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JMenuItem lock;
    private javax.swing.JMenuItem mnBuku;
    private javax.swing.JPanel panel;
    private javax.swing.JLabel txtNama;
    // End of variables declaration                  
}

class BgSplash extends PanelUI{
    ImageIcon Background = new
    ImageIcon(getClass().getResource("/gambar/andicki4.jpg"));
    @Override
    public void paint(Graphics g, JComponent c){
        g.drawImage(Background.getImage(),0,0,null);
    }
}

Comments

Popular posts from this blog

contoh proposal asistem aplikasi jasa laundry

Naskah Drama Bahasa Sunda

penjualan