Package UI;
The import DBConnect. Student_DBC;
import java.awt.Color;
Import the Java. The awt. FlowLayout;
The import javax.mail. Swing. Icon;//framework underlying picture insert
The import javax.mail. Swing. ImageIcon; Within the framework of//container insert images and component a plane
Import the Java. The awt. The Font;
Import the Java. The awt. Dimension;//encapsulates a component the height and width of the
Import the Java. The awt. FlowLayout;
/*
Import the Java. Text. SimpleDateFormat;//time
Import the Java. Util. Date;
The import javax.mail. Swing. The Timer;
*/
The import javax.mail. Swing. JFrame;
The import javax.mail. Swing. JPanel;
The import javax.mail. Swing. JLabel;
The import javax.mail. Swing. JTextField;
The import javax.mail. Swing. JPasswordField;
The import javax.mail. Swing. JButton;
//
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
Public class Login extends JFrame {
JFrame frame;
JPanel panel;
JLabel label1, label2, label3, label4;
JTextField textfield.
JPasswordField pf.
JButton for button2, button3;
//the Panel bottom pictures inserted
Private Icon p=new ImageIcon (" E: \ \ (2020-2021) (after) Sophomore \ \ JAVA Project \ \ ExMgSt_NIIT1_GN4 \ \ SRC \ \ IMG_1 \ \ \ \ 13 of science and technology. The JPG ");
The Login ()
{
The panel=new JPanel ();
Panel. SetSize (2000, 1500);
The panel. SetLayout (null);//new FlowLayout (FlowLayout CENTER)
Add (panel);
Label3=new JLabel (p);//the Panel bottom pictures inserted
Label3. SetBounds (0, 0, 1000, 900);
Label3. SetIcon (p);
ImageIcon I=new ImageIcon (" E://(2020-2021) (after) Sophomore//JAVA Project//ExMgSt_NIIT1_GN4//SRC//IMG_1//technology//14. JPG ");
Label4=new JLabel (I);
Label4. SetBounds (700, 0, 300, 280);
A panel. The add (label4);
Label1=new JLabel (" Login ID ");
Label1. SetBounds (40, 250, 300, 60).
A panel. The add (label1);
The Font of f1=new Font (" Courier ", the Font BOLD, 30);
Label1. SetFont (f1);
Textfield=new JTextField ();
Textfield. SetBounds (200, 250, 400, 60).
The Font f6=new Font (" Courier ", the Font, BOLD, 18);
Textfield. SetFont (f6);
A panel. The add (textfield);
Label2=new JLabel (" PassWord ");
Label2. SetBounds (40, 350, 300, 60).
A panel. The add (label2);
The Font f2=new Font (" Courier ", the Font, BOLD, 30);
Label2. SetFont (f2);
Pf=new JPasswordField ();
Pf. SetBounds (200, 350, 400, 60).
The Font f7=new Font (" Courier ", the Font, BOLD, 18);
Pf. SetFont (f7);
A panel. The add (pf);
For the=new JButton (" Login ");
For the setBounds (200, 450, 400, 50);
For the addActionListener (
New ActionListener ()
{
@ Override
Public void actionPerformed (an ActionEvent e) {
The String u=textfield. GetText ();
String p=pf the getText ();
//database connection
Student_DBC sd=new Student_DBC ();
Boolean ch=sd. Check (u, p);
If (u.e quals (" leader ") & amp; & P.e quals (" leader @ nxu "))
{
JOptionPane. ShowMessageDialog (null, "Login Success To the Admin Page!" );
//Display the Admin Page
The Admin AD=new Admin ();
}
Else if (u.e quals (" ") & amp; & P.e quals (" "))
{
JOptionPane. ShowMessageDialog (null, "Login Success!" );
//Display Student Page
Student_SP ss=new Student_SP ();
}
Else if (ch=false)
{
JOptionPane. ShowMessageDialog (null, "the Login Fails! "+ u);
}
The else
{
JOptionPane. ShowMessageDialog (null, "No account, both please go to register!" );
}
}
}
);
A panel. The add (for);
The Font f3=new Font (" Courier ", the Font, BOLD, 30);
For the setFont (f3);
Button2=new JButton (" Student Registration ");
Button2. SetBounds (200, 530, 400, 50);
Button2. AddActionListener (
New ActionListener ()
{
@ Override
Public void actionPerformed (an ActionEvent e)
{
StudentRegister sr=new StudentRegister ();
The dispose ();
}
}
);
A panel. The add (button2);
The Font f4=new Font (" Courier ", the Font, BOLD, 30);
Button2. SetFont (f4);
Button3=new JButton (" Exit ");
Button3. SetBounds (200, 620, 400, 50);
Button3. SetBackground (Color. White);//background color button
Button3. SetForeground (Color. Orange);//button font color in
Button3. AddActionListener (new ActionListener () {
@ Override
Public void actionPerformed (an ActionEvent e) {
WelcomePage inf=new WelcomePage ();
The dispose ();
}
}
);
A panel. The add (button3);
The Font f5=new Font (" Courier ", the Font, BOLD, 30);
Button3. SetFont (f5);
SetTitle (" Login Page ");
SetSize (1000, 900);
//setLayout (new FlowLayout (FlowLayout. CENTER));
SetDefaultCloseOperation (JFrame. EXIT_ON_CLOSE);
setLocationRelativeTo(null);
SetVisible (true);
A panel. The add (label3);
}
Public static void main (String [] args) {
The Login l=new Login ();
}
}