Advertisement
Metziop

vistaadmin

Jun 15th, 2021
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 14.62 KB | None | 0 0
  1. package vistas;
  2.  
  3. import Conexion.logOut;
  4. import Conexion.loginSesion;
  5. import java.io.IOException;
  6. import java.net.Socket;
  7. import java.util.logging.Level;
  8. import java.util.logging.Logger;
  9.  
  10.  
  11. /**
  12.  *
  13.  * @author dario
  14.  */
  15. public class vistaAdmin extends javax.swing.JFrame {
  16.  
  17.     /**
  18.      * Creates new form vistaAdmin
  19.      */
  20.     public vistaAdmin() {
  21.         initComponents();
  22.         this.setLocationRelativeTo(null);
  23.         lbUser.setText(loginSesion.user);
  24.         lbTipo.setText(loginSesion.puesto);
  25.     }
  26.  
  27.     /**
  28.      * This method is called from within the constructor to initialize the form.
  29.      * WARNING: Do NOT modify this code. The content of this method is always
  30.      * regenerated by the Form Editor.
  31.      */
  32.     @SuppressWarnings("unchecked")
  33.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  34.     private void initComponents() {
  35.  
  36.         jPanel1 = new javax.swing.JPanel();
  37.         jLabel1 = new javax.swing.JLabel();
  38.         jLabel2 = new javax.swing.JLabel();
  39.         jLabel3 = new javax.swing.JLabel();
  40.         jLabel4 = new javax.swing.JLabel();
  41.         lbUser = new javax.swing.JLabel();
  42.         lbTipo = new javax.swing.JLabel();
  43.         jLabel5 = new javax.swing.JLabel();
  44.         btnChat = new javax.swing.JButton();
  45.         jMenuBar1 = new javax.swing.JMenuBar();
  46.         jMenu1 = new javax.swing.JMenu();
  47.         jMenuItem1 = new javax.swing.JMenuItem();
  48.         jMenuItem2 = new javax.swing.JMenuItem();
  49.         jMenu2 = new javax.swing.JMenu();
  50.         jMenuItem3 = new javax.swing.JMenuItem();
  51.         jMenuItem4 = new javax.swing.JMenuItem();
  52.         jMenu4 = new javax.swing.JMenu();
  53.         jMenuItem6 = new javax.swing.JMenuItem();
  54.  
  55.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  56.         setBackground(new java.awt.Color(255, 255, 255));
  57.         setSize(new java.awt.Dimension(800, 600));
  58.         getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
  59.  
  60.         jPanel1.setBackground(new java.awt.Color(255, 255, 255));
  61.         jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
  62.  
  63.         jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/log0.png"))); // NOI18N
  64.         jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 100, -1, -1));
  65.         jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 10, -1, -1));
  66.  
  67.         jLabel3.setFont(new java.awt.Font("Montserrat Black", 1, 12)); // NOI18N
  68.         jLabel3.setForeground(new java.awt.Color(122, 14, 2));
  69.         jLabel3.setText("USUARIO:");
  70.         jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 30, -1, -1));
  71.  
  72.         jLabel4.setFont(new java.awt.Font("Montserrat Black", 1, 12)); // NOI18N
  73.         jLabel4.setForeground(new java.awt.Color(122, 14, 2));
  74.         jLabel4.setText("ROL:");
  75.         jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(600, 50, -1, -1));
  76.  
  77.         lbUser.setFont(new java.awt.Font("Montserrat ExtraBold", 0, 12)); // NOI18N
  78.         lbUser.setForeground(new java.awt.Color(122, 14, 2));
  79.         jPanel1.add(lbUser, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 30, -1, -1));
  80.  
  81.         lbTipo.setFont(new java.awt.Font("Montserrat ExtraBold", 0, 12)); // NOI18N
  82.         lbTipo.setForeground(new java.awt.Color(122, 14, 2));
  83.         jPanel1.add(lbTipo, new org.netbeans.lib.awtextra.AbsoluteConstraints(640, 50, -1, -1));
  84.  
  85.         jLabel5.setFont(new java.awt.Font("Montserrat ExtraBold", 0, 12)); // NOI18N
  86.         jLabel5.setForeground(new java.awt.Color(122, 14, 2));
  87.         jLabel5.setText("SALIR");
  88.         jLabel5.setToolTipText("");
  89.         jLabel5.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  90.         jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
  91.             public void mouseClicked(java.awt.event.MouseEvent evt) {
  92.                 jLabel5MouseClicked(evt);
  93.             }
  94.         });
  95.         jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(680, 70, -1, -1));
  96.  
  97.         btnChat.setBackground(new java.awt.Color(255, 255, 255));
  98.         btnChat.setFont(new java.awt.Font("Montserrat ExtraBold", 0, 14)); // NOI18N
  99.         btnChat.setForeground(new java.awt.Color(114, 22, 2));
  100.         btnChat.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_chat_30px.png"))); // NOI18N
  101.         btnChat.setText("Chat");
  102.         btnChat.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(114, 22, 2), 1, true));
  103.         btnChat.addActionListener(new java.awt.event.ActionListener() {
  104.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  105.                 btnChatActionPerformed(evt);
  106.             }
  107.         });
  108.         jPanel1.add(btnChat, new org.netbeans.lib.awtextra.AbsoluteConstraints(1060, 500, 120, 50));
  109.  
  110.         getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 800, 560));
  111.  
  112.         jMenuBar1.setBackground(new java.awt.Color(255, 255, 255));
  113.         jMenuBar1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  114.         jMenuBar1.setForeground(new java.awt.Color(122, 14, 2));
  115.         jMenuBar1.setFont(new java.awt.Font("Montserrat", 1, 12)); // NOI18N
  116.  
  117.         jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_management_30px.png"))); // NOI18N
  118.         jMenu1.setText("Empleados");
  119.         jMenu1.setFont(new java.awt.Font("Montserrat Black", 0, 12)); // NOI18N
  120.  
  121.         jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK));
  122.         jMenuItem1.setBackground(new java.awt.Color(255, 255, 255));
  123.         jMenuItem1.setFont(new java.awt.Font("Montserrat Light", 0, 12)); // NOI18N
  124.         jMenuItem1.setForeground(new java.awt.Color(122, 14, 2));
  125.         jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_member_30px_1.png"))); // NOI18N
  126.         jMenuItem1.setText("Agregar");
  127.         jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
  128.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  129.                 jMenuItem1ActionPerformed(evt);
  130.             }
  131.         });
  132.         jMenu1.add(jMenuItem1);
  133.  
  134.         jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.ALT_MASK));
  135.         jMenuItem2.setFont(new java.awt.Font("Montserrat Light", 0, 12)); // NOI18N
  136.         jMenuItem2.setForeground(new java.awt.Color(122, 14, 2));
  137.         jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_delete_user_male_30px_1.png"))); // NOI18N
  138.         jMenuItem2.setText("Eliminar");
  139.         jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
  140.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  141.                 jMenuItem2ActionPerformed(evt);
  142.             }
  143.         });
  144.         jMenu1.add(jMenuItem2);
  145.  
  146.         jMenuBar1.add(jMenu1);
  147.  
  148.         jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_task_30px.png"))); // NOI18N
  149.         jMenu2.setText("Pedidos");
  150.         jMenu2.setFont(new java.awt.Font("Montserrat Black", 0, 12)); // NOI18N
  151.  
  152.         jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
  153.         jMenuItem3.setBackground(new java.awt.Color(255, 255, 255));
  154.         jMenuItem3.setFont(new java.awt.Font("Montserrat Light", 0, 12)); // NOI18N
  155.         jMenuItem3.setForeground(new java.awt.Color(122, 14, 2));
  156.         jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_spring_30px_2.png"))); // NOI18N
  157.         jMenuItem3.setText("Arreglos");
  158.         jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
  159.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  160.                 jMenuItem3ActionPerformed(evt);
  161.             }
  162.         });
  163.         jMenu2.add(jMenuItem3);
  164.  
  165.         jMenuItem4.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
  166.         jMenuItem4.setFont(new java.awt.Font("Montserrat Light", 0, 12)); // NOI18N
  167.         jMenuItem4.setForeground(new java.awt.Color(122, 14, 2));
  168.         jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_job_30px.png"))); // NOI18N
  169.         jMenuItem4.setText("Asignaciónes");
  170.         jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
  171.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  172.                 jMenuItem4ActionPerformed(evt);
  173.             }
  174.         });
  175.         jMenu2.add(jMenuItem4);
  176.  
  177.         jMenuBar1.add(jMenu2);
  178.  
  179.         jMenu4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_member_30px.png"))); // NOI18N
  180.         jMenu4.setText("Comunicacion");
  181.         jMenu4.setFont(new java.awt.Font("Montserrat Black", 0, 12)); // NOI18N
  182.  
  183.         jMenuItem6.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
  184.         jMenuItem6.setBackground(new java.awt.Color(255, 255, 255));
  185.         jMenuItem6.setFont(new java.awt.Font("Montserrat Light", 0, 12)); // NOI18N
  186.         jMenuItem6.setForeground(new java.awt.Color(122, 14, 2));
  187.         jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/icons8_chat_30px.png"))); // NOI18N
  188.         jMenuItem6.setText("Chat");
  189.         jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
  190.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  191.                 jMenuItem6ActionPerformed(evt);
  192.             }
  193.         });
  194.         jMenu4.add(jMenuItem6);
  195.  
  196.         jMenuBar1.add(jMenu4);
  197.  
  198.         setJMenuBar(jMenuBar1);
  199.  
  200.         pack();
  201.     }// </editor-fold>                        
  202.  
  203.     private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  204.         new frmEmpleados(this, true).setVisible(true);
  205.        
  206.        
  207.     }                                          
  208.  
  209.     private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  210.         new frmBorrarEmp(this, true).setVisible(true);
  211.     }                                          
  212.  
  213.     private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {                                    
  214.         login login= new login();
  215.         logOut.logout(this, login);
  216.     }                                    
  217.  
  218.     private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  219.         new frmCatalogoArreglo(this, true).setVisible(true);
  220.     }                                          
  221.  
  222.     private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  223.         new frmAsignacion (this, true).setVisible(true);
  224.     }                                          
  225.  
  226.     private void btnChatActionPerformed(java.awt.event.ActionEvent evt) {                                        
  227.         try {
  228.             String user = Conexion.loginSesion.user;
  229.             Socket s= new Socket("localhost", 5000);
  230.             new controlador.ClientView(user, s).setVisible(true);
  231.         } catch (IOException ex) {
  232.             Logger.getLogger(vistaSupervisor.class.getName()).log(Level.SEVERE, null, ex);
  233.         }
  234.     }                                      
  235.  
  236.     private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  237.                                            
  238.         try {
  239.             String user = Conexion.loginSesion.user;
  240.             Socket s= new Socket("localhost", 5000);
  241.             new controlador.ClientView(user, s).setVisible(true);
  242.         } catch (IOException ex) {
  243.             Logger.getLogger(vistaSupervisor.class.getName()).log(Level.SEVERE, null, ex);
  244.         }
  245.     }                                          
  246.  
  247.     /**
  248.      * @param args the command line arguments
  249.      */
  250.     public static void main(String args[]) {
  251.         /* Set the Nimbus look and feel */
  252.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  253.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  254.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  255.          */
  256.         try {
  257.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  258.                 if ("Nimbus".equals(info.getName())) {
  259.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  260.                     break;
  261.                 }
  262.             }
  263.         } catch (ClassNotFoundException ex) {
  264.             java.util.logging.Logger.getLogger(vistaAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  265.         } catch (InstantiationException ex) {
  266.             java.util.logging.Logger.getLogger(vistaAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  267.         } catch (IllegalAccessException ex) {
  268.             java.util.logging.Logger.getLogger(vistaAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  269.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  270.             java.util.logging.Logger.getLogger(vistaAdmin.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  271.         }
  272.         //</editor-fold>
  273.  
  274.         /* Create and display the form */
  275.         java.awt.EventQueue.invokeLater(new Runnable() {
  276.             public void run() {
  277.                 new vistaAdmin().setVisible(true);
  278.             }
  279.         });
  280.     }
  281.  
  282.     // Variables declaration - do not modify                    
  283.     private javax.swing.JButton btnChat;
  284.     private javax.swing.JLabel jLabel1;
  285.     private javax.swing.JLabel jLabel2;
  286.     private javax.swing.JLabel jLabel3;
  287.     private javax.swing.JLabel jLabel4;
  288.     private javax.swing.JLabel jLabel5;
  289.     private javax.swing.JMenu jMenu1;
  290.     private javax.swing.JMenu jMenu2;
  291.     private javax.swing.JMenu jMenu4;
  292.     private javax.swing.JMenuBar jMenuBar1;
  293.     private javax.swing.JMenuItem jMenuItem1;
  294.     private javax.swing.JMenuItem jMenuItem2;
  295.     private javax.swing.JMenuItem jMenuItem3;
  296.     private javax.swing.JMenuItem jMenuItem4;
  297.     private javax.swing.JMenuItem jMenuItem6;
  298.     private javax.swing.JPanel jPanel1;
  299.     private javax.swing.JLabel lbTipo;
  300.     private javax.swing.JLabel lbUser;
  301.     // End of variables declaration                  
  302. }
  303.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement