Advertisement
rangga_hrdme

Logout: Error

May 2nd, 2021
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.00 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package ticketing;
  7.  
  8.  
  9.  
  10. import javax.swing.JFrame;
  11. import javax.swing.JOptionPane;
  12.  
  13. /**
  14.  *
  15.  * @author ta
  16.  */
  17. public class Board extends javax.swing.JFrame {
  18.  
  19.     /**
  20.      * Creates new form Board
  21.      */
  22.     public Board() {
  23.         initComponents();
  24.         this.setExtendedState(JFrame.MAXIMIZED_BOTH);
  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.         MenuBar = new javax.swing.JMenuBar();
  37.         mSystem = new javax.swing.JMenu();
  38.         itUser = new javax.swing.JMenuItem();
  39.         itLogout = new javax.swing.JMenuItem();
  40.         itExit = new javax.swing.JMenuItem();
  41.         mMaster = new javax.swing.JMenu();
  42.         itTicket = new javax.swing.JMenuItem();
  43.  
  44.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  45.  
  46.         MenuBar.setToolTipText("allMenu");
  47.  
  48.         mSystem.setText("System");
  49.         mSystem.setToolTipText("system");
  50.  
  51.         itUser.setText("User");
  52.         itUser.setToolTipText("user");
  53.         itUser.addActionListener(new java.awt.event.ActionListener() {
  54.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  55.                 itUserActionPerformed(evt);
  56.             }
  57.         });
  58.         mSystem.add(itUser);
  59.  
  60.         itLogout.setText("Logout");
  61.         itLogout.setToolTipText("logout");
  62.         itLogout.addActionListener(new java.awt.event.ActionListener() {
  63.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  64.                 itLogoutActionPerformed(evt);
  65.             }
  66.         });
  67.         mSystem.add(itLogout);
  68.  
  69.         itExit.setText("Exit");
  70.         itExit.setToolTipText("exit");
  71.         itExit.addActionListener(new java.awt.event.ActionListener() {
  72.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  73.                 itExitActionPerformed(evt);
  74.             }
  75.         });
  76.         mSystem.add(itExit);
  77.  
  78.         MenuBar.add(mSystem);
  79.  
  80.         mMaster.setText("Master");
  81.         mMaster.setToolTipText("master");
  82.  
  83.         itTicket.setText("Ticket");
  84.         itTicket.setToolTipText("ticket");
  85.         itTicket.addActionListener(new java.awt.event.ActionListener() {
  86.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  87.                 itTicketActionPerformed(evt);
  88.             }
  89.         });
  90.         mMaster.add(itTicket);
  91.  
  92.         MenuBar.add(mMaster);
  93.  
  94.         setJMenuBar(MenuBar);
  95.  
  96.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  97.         getContentPane().setLayout(layout);
  98.         layout.setHorizontalGroup(
  99.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  100.             .addGap(0, 400, Short.MAX_VALUE)
  101.         );
  102.         layout.setVerticalGroup(
  103.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  104.             .addGap(0, 279, Short.MAX_VALUE)
  105.         );
  106.  
  107.         pack();
  108.     }// </editor-fold>                        
  109.  
  110.     private void itUserActionPerformed(java.awt.event.ActionEvent evt) {                                      
  111.         // TODO add your handling code here:
  112.     }                                      
  113.  
  114.     private void itExitActionPerformed(java.awt.event.ActionEvent evt) {                                      
  115.          int result = JOptionPane.showConfirmDialog(this,
  116.         "Apakah Anda akan keluar dari system?",
  117.         "Keluar dari system", JOptionPane.YES_NO_OPTION);
  118. if (result == JOptionPane.YES_OPTION) System.exit(0);
  119.        
  120.        
  121.     }                                      
  122.  
  123.     private void itTicketActionPerformed(java.awt.event.ActionEvent evt) {                                        
  124.         // TODO add your handling code here:
  125.     }                                        
  126.  
  127.     private void itLogoutActionPerformed(java.awt.event.ActionEvent evt) {                                        
  128.         Login Log =  new Login();
  129.         Log.setTitle("Login");
  130.         Log.setVisible(true);
  131.         this.dispose();      
  132.        
  133.     }                                        
  134.  
  135.     private void itLogoutActionPerformed(java.awt.event.ActionEvent){
  136.         try{
  137.             Login Log = new Login();
  138.             Log.setTitle("Login");
  139.             Log.setVisible(true);
  140.             this.dispose();
  141.         } catch (IOException ex){
  142.                 Logger.getLogger(Board.class.getName()).log(Level.SEVERE, null, ex);
  143.         }
  144.     }
  145.    
  146.     /**
  147.      * @param args the command line arguments
  148.      */
  149.     public static void main(String args[]) {
  150.         /* Set the Nimbus look and feel */
  151.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  152.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  153.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  154.          */
  155.         try {
  156.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  157.                 if ("Nimbus".equals(info.getName())) {
  158.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  159.                     break;
  160.                 }
  161.             }
  162.         } catch (ClassNotFoundException ex) {
  163.             java.util.logging.Logger.getLogger(Board.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  164.         } catch (InstantiationException ex) {
  165.             java.util.logging.Logger.getLogger(Board.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  166.         } catch (IllegalAccessException ex) {
  167.             java.util.logging.Logger.getLogger(Board.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  168.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  169.             java.util.logging.Logger.getLogger(Board.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  170.         }
  171.         //</editor-fold>
  172.  
  173.         /* Create and display the form */
  174.         java.awt.EventQueue.invokeLater(new Runnable() {
  175.             public void run() {
  176.                 new Board().setVisible(true);
  177.             }
  178.         });
  179.     }
  180.  
  181.     // Variables declaration - do not modify                    
  182.     private javax.swing.JMenuBar MenuBar;
  183.     private javax.swing.JMenuItem itExit;
  184.     private javax.swing.JMenuItem itLogout;
  185.     private javax.swing.JMenuItem itTicket;
  186.     private javax.swing.JMenuItem itUser;
  187.     private javax.swing.JMenu mMaster;
  188.     private javax.swing.JMenu mSystem;
  189.     // End of variables declaration                  
  190.  
  191.    
  192. }
  193.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement