Industrial Training Day 2


Day 2: In 16 May, 2019 we have implemented the functionalities to the Frame created on 15th May,2019. We implemented functionality like to move from one frame another frame. Login Credential validation, Enabling the exit button, Changing the text color of label on Click Event and Signing Up the User.
  Work Done:
11)     Moving the Frame to another Frame: For this we have used the setVisible() method to visible the form and hide current form.
2 2)     Login Credential Check: For this we have created function checkCredential() method to check login id and password.
   void checkCredential() {
        try {
            String uname = txtUname.getText();
            String upwd = new String(txtPwd.getPassword());
            //JOptionPane.showMessageDialog(this,uname);
           
            // To Check Credentials   
            if (uname.equals("User") && upwd.equals("Pass1")) {
                lblstatus.setText(" Login Success ");
            } else {
                lblstatus.setText(" Invalid Credentails ");
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
  }

     


3)     For changing color on clicking the Label: For this we have used MouseClick Event of java.awt.event package. Then we set the foreground color of the label using setForeground(Color) in-built method of java.awt.Color class.
4)     For Exit: To exit we have used System.exit(0) method.
5)     For Sign-Up: In this we have implemented that if there is blank in TextField then it will not accept the Submit and if all fields are filled then Submit Button will directly Move into Login Frame. 

                                    





Follow Standards:  Use Variable with same starting
 ex: 1) Button: btn   
 2) TextField: txt
 3) Lable: lbl

To do Auto Indentation Use: Alt + Shift  + f
To go to the function: Ctrl
To get Function:  Ctrl + Space
To import : Alt+Shift+i
To show Popup:  JOptionPane.showMessageDialog(this,”Message”);











Previous
Next Post »