How to Create a Video Login page in Jframe In Java Netbeans

 


Here Is the source Code

Subscribe and comment !!

package javaapplication4;

        

import jaco.mp3.player.MP3Player;

import java.io.File;

import javax.swing.JFrame;

import javax.swing.JOptionPane;


/**

 *

 * @author jeeva

 */

public class Loginpage extends javax.swing.JFrame {


    

    public Loginpage() {

        initComponents();

        

        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        setExtendedState(JFrame.MAXIMIZED_HORIZ); 

        setResizable(false);

    

    }


    /**

     * 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() {


        jPanel1 = new javax.swing.JPanel();

        User = new javax.swing.JTextField();

        jLabel2 = new javax.swing.JLabel();

        login = new javax.swing.JButton();

        jButton2 = new javax.swing.JButton();

        Pass = new javax.swing.JPasswordField();

        ji = new javax.swing.JCheckBox();

        U = new javax.swing.JLabel();

        P = new javax.swing.JLabel();

        jLabel1 = new javax.swing.JLabel();

        jLabel5 = new javax.swing.JLabel();

        jLabel3 = new javax.swing.JLabel();


        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        setMaximumSize(new java.awt.Dimension(1235, 648));

        setMinimumSize(new java.awt.Dimension(1235, 648));

        setUndecorated(true);


        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        jPanel1.setLayout(null);


        User.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

        User.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                UserActionPerformed(evt);

            }

        });

        User.addKeyListener(new java.awt.event.KeyAdapter() {

            public void keyPressed(java.awt.event.KeyEvent evt) {

                UserKeyPressed(evt);

            }

            public void keyReleased(java.awt.event.KeyEvent evt) {

                UserKeyReleased(evt);

            }

        });

        jPanel1.add(User);

        User.setBounds(980, 410, 230, 30);


        jLabel2.setFont(new java.awt.Font("Ink Free", 1, 24)); // NOI18N

        jLabel2.setForeground(new java.awt.Color(51, 102, 255));

        jLabel2.setText("Password");

        jPanel1.add(jLabel2);

        jLabel2.setBounds(800, 470, 150, 40);


        login.setBackground(new java.awt.Color(255, 255, 255));

        login.setFont(new java.awt.Font("Sylfaen", 1, 24)); // NOI18N

        login.setForeground(new java.awt.Color(51, 102, 255));

        login.setText("Login");

        login.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                loginActionPerformed(evt);

            }

        });

        jPanel1.add(login);

        login.setBounds(770, 590, 150, 41);


        jButton2.setBackground(new java.awt.Color(255, 255, 255));

        jButton2.setFont(new java.awt.Font("Yu Gothic", 1, 24)); // NOI18N

        jButton2.setForeground(new java.awt.Color(51, 102, 255));

        jButton2.setText("Reset");

        jButton2.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                jButton2ActionPerformed(evt);

            }

        });

        jPanel1.add(jButton2);

        jButton2.setBounds(970, 590, 177, 49);


        Pass.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

        Pass.addKeyListener(new java.awt.event.KeyAdapter() {

            public void keyReleased(java.awt.event.KeyEvent evt) {

                PassKeyReleased(evt);

            }

        });

        jPanel1.add(Pass);

        Pass.setBounds(980, 470, 230, 30);


        ji.setBackground(new java.awt.Color(255, 255, 255));

        ji.setFont(new java.awt.Font("Ink Free", 1, 18)); // NOI18N

        ji.setForeground(new java.awt.Color(51, 102, 255));

        ji.setText("Show Password");

        ji.setMaximumSize(new java.awt.Dimension(6, 20));

        ji.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                jiActionPerformed(evt);

            }

        });

        jPanel1.add(ji);

        ji.setBounds(800, 530, 410, 30);


        U.setBackground(new java.awt.Color(255, 255, 255));

        U.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

        U.setForeground(new java.awt.Color(51, 153, 255));

        U.setMaximumSize(new java.awt.Dimension(2147483647, 2147483647));

        U.setMinimumSize(new java.awt.Dimension(6, 35));

        jPanel1.add(U);

        U.setBounds(411, 293, 400, 30);


        P.setBackground(new java.awt.Color(255, 255, 255));

        P.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

        P.setForeground(new java.awt.Color(0, 153, 255));

        P.setMaximumSize(new java.awt.Dimension(2147483647, 2147483647));

        P.setMinimumSize(new java.awt.Dimension(6, 35));

        jPanel1.add(P);

        P.setBounds(270, 430, 410, 30);


        jLabel1.setBackground(new java.awt.Color(255, 255, 255));

        jLabel1.setFont(new java.awt.Font("Ink Free", 1, 24)); // NOI18N

        jLabel1.setForeground(new java.awt.Color(51, 102, 255));

        jLabel1.setText("UserName");

        jPanel1.add(jLabel1);

        jLabel1.setBounds(800, 390, 160, 60);


        jLabel5.setIcon(new javax.swing.ImageIcon("C:\\Users\\freec\\Desktop\\ip.jpg")); // NOI18N

        jLabel5.setText("jLabel5");

        jPanel1.add(jLabel5);

        jLabel5.setBounds(830, -60, 340, 570);


        jLabel3.setIcon(new javax.swing.ImageIcon("C:\\Users\\freec\\Desktop\\djbhsa.gif")); // NOI18N

        jLabel3.setText("jLabel3");

        jPanel1.add(jLabel3);

        jLabel3.setBounds(0, 0, 730, 650);


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

        getContentPane().setLayout(layout);

        layout.setHorizontalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 1235, Short.MAX_VALUE)

        );

        layout.setVerticalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 648, Short.MAX_VALUE)

        );


        pack();

        setLocationRelativeTo(null);

    }// </editor-fold>                        


    private void UserActionPerformed(java.awt.event.ActionEvent evt) {                                     


    }                                    


    private void UserKeyPressed(java.awt.event.KeyEvent evt) {                                


    }                               


    private void UserKeyReleased(java.awt.event.KeyEvent evt) {                                 

        U.setText("");

    }                                


    private void loginActionPerformed(java.awt.event.ActionEvent evt) {                                      


        String pass= Pass.getText();

        String user= User.getText();

        if(User.getText().trim().isEmpty() && Pass.getText().trim().isEmpty()){

            U.setText("Username Field should not be left empty");

            P.setText("Password Field should not be left empty");

        }

        else if(User.getText().trim().isEmpty())

        {

            U.setText("Username Field should not be left empty");

        }

        else if(Pass.getText().trim().isEmpty())

        {

            P.setText("Password Field should not be left empty");

        }

        {


            User();


        }

    }                                     


    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        Pass.setText(null);

        User.setText(null);

    }                                        


    private void PassKeyReleased(java.awt.event.KeyEvent evt) {                                 

        P.setText("");

    }                                

 //----Sound Methods from Sound1 to Sound6

 //These are the methods to play sound effects.

     

    private void jiActionPerformed(java.awt.event.ActionEvent evt) {                                   

        if(ji.isSelected())

        {

            Pass.setEchoChar((char)0);

        }

        else

        {

            Pass.setEchoChar('*');

        }

    }                                  


    /**

     * @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(Loginpage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (InstantiationException ex) {

            java.util.logging.Logger.getLogger(Loginpage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (IllegalAccessException ex) {

            java.util.logging.Logger.getLogger(Loginpage.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (javax.swing.UnsupportedLookAndFeelException ex) {

            java.util.logging.Logger.getLogger(Loginpage.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 Loginpage().setVisible(true);

                new MP3Player(new File("C:\\Users\\freec\\Desktop\\V.mp3")).play();

            }

        });

    }


    // Variables declaration - do not modify                     

    private javax.swing.JLabel P;

    private javax.swing.JPasswordField Pass;

    private javax.swing.JLabel U;

    private javax.swing.JTextField User;

    private javax.swing.JButton jButton2;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JLabel jLabel3;

    private javax.swing.JLabel jLabel5;

    private javax.swing.JPanel jPanel1;

    private javax.swing.JCheckBox ji;

    private javax.swing.JButton login;

    // End of variables declaration                   


//method to call login of various users.

    

    private  void User()

       { 

           String pass= Pass.getText();

       

        String user= User.getText();

       

        {

            if (user.contains("Hyjarsh")&&pass.contains("2989.0")) {

            Pass.setText(null);

            User.setText(null);       

            setVisible(false);

           

            }

            

         

        

  else if (user.contains("Vinod Sharma")&&pass.contains("Iron man of india")) {

            Pass.setText(null);

            User.setText(null);       

            

            

           }

            


 else if (user.contains("George")&&pass.contains("Intelligence")) {

            Pass.setText(null);

            User.setText(null);       

            setVisible(false);

          

            }

         


      else   if (user.contains("Soniuhal")&&pass.contains("I love my bro")){

            Pass.setText(null);

            User.setText(null);       

            setVisible(false);

           

           

      }

 

       else if (user.contains("Davinder")&&pass.contains("My lost friend")) {

            Pass.setText(null);

            User.setText(null);       

            setVisible(false);

            

          

        } 

        

            

        else{

            JOptionPane.showMessageDialog(null,"INVALID LOGIN DETAILS","Login Error",JOptionPane.ERROR_MESSAGE);

        Pass.setText(null);

        User.setText(null);}}}}

How to Play video in jrame in netbeans

https://www.youtube.com/watch?v=dECzEcLT--U


Comments

Popular posts from this blog

Airline Ticket Reservation System Project in Java Netbeans

How to Create a ProgressBar with a button in Java Netbeans.