Home > Back-end >  Java classes have made a student information management system, database connection is successful, t
Java classes have made a student information management system, database connection is successful, t

Time:10-12

Please, save the children 8

CodePudding user response:

Code is not sticky, who knows where you have any question

CodePudding user response:

reference 1st floor hurtCat response:
code is not sticky, who knows you have a problem where

Several hundreds of lines of code package can't stick a??

CodePudding user response:

Import the Java. The awt. Event. An ActionEvent;
Import the Java. The awt. Event. ActionListener;

The import javax.mail. Swing. ButtonGroup;
The import javax.mail. Swing. JButton;
The import javax.mail. Swing. JFrame;
The import javax.mail. Swing. JLabel;
The import javax.mail. Swing. JOptionPane;
The import javax.mail. Swing. JPanel;
The import javax.mail. Swing. JPasswordField;
The import javax.mail. Swing. JRadioButton;
The import javax.mail. Swing. JTextField;

The import com. Student. Score. Service. StudentService;
The import com. Student. Score. Service. TeacherService;

/* *
* login window
*/
Public class LoginFrame extends JFrame implements ActionListener
{
private static final long serialVersionUID=1L;


JPanel panel=new JPanel ();
JLabel label1=new JLabel (" input the ID: ");
JTextField name=new JTextField ();
JLabel label2=new JLabel (" secret code: ");
JPasswordField PWD=new JPasswordField ();
JButton Enter=new JButton (" login ");
JButton Exit=new JButton (" quit ");
ButtonGroup BGP=new ButtonGroup ();
JRadioButton stu=new JRadioButton (" students ");
JRadioButton TCH=new JRadioButton (" teacher ");

Public LoginFrame ()
{
Super (" login system ");
Enclosing setResizable (false);
Stu. SetBounds (165210,70,20);
Stu. SetSelected (true);
TCH. SetBounds (265210,70,20);
BGP. The add (stu);
BGP. The add (TCH);
A panel. The add (stu);
A panel. The add (TCH);
Enter the setBounds,80,20 (150250);
Exit. SetBounds (270250,80,20);
Enter. AddActionListener (this);
Exit. AddActionListener (this);
A panel. The add (Enter);
A panel. The add (Exit);
The panel. SetLayout (null);
This. The add (panel);
Label1. SetBounds (135130100);
A panel. The add (label1);
Name. The setBounds (265130100);
panel.add(name);
Label2. SetBounds (135165100);
A panel. The add (label2);
PWD. SetBounds (265165100);
A panel. The add (PWD);
Enclosing setBounds (100100500350);
this.setVisible(true);
Enclosing setDefaultCloseOperation (JFrame. EXIT_ON_CLOSE);
}

Public void actionPerformed (an ActionEvent e)
{
String username=name. The getText ();
String password=new String (PWD. GetPassword ());
If (um participant etSource ()==Enter) {
{if (stu. An isSelected ())
Try {
If (StudentService. Validate (username, password)) {
JOptionPane. ShowMessageDialog (this, "login successfully!" );
New StudentFrame ();
Enclosing the dispose ();
} else {
JOptionPane. ShowMessageDialog (this, "logon failure, the user name or password error, please try again");
}
{} the catch (Exception ex)
Ex. PrintStackTrace ();
JOptionPane. ShowMessageDialog (this, "abnormal access database");
}
} else if (TCH. An isSelected ()) {
Try {
If (TeacherService. Validate (username, password)) {
JOptionPane. ShowMessageDialog (this, "login successfully!" );
New TeacherFrame ();
Enclosing the dispose ();
} else {
JOptionPane. ShowMessageDialog (this, "logon failure, the user name or password error, please try again");
}
{} the catch (Exception ex)
Ex. PrintStackTrace ();
JOptionPane. ShowMessageDialog (this, "abnormal access database");
}
}
}
The else
{
System.exit(0);
}
}
}

CodePudding user response:

CodePudding user response:

The
reference 4 floor qq_46466757 reply:


Add a main method, the method to write the following statement, you don't have the main cannot perform, of course,

New LoginFrame ();

CodePudding user response:

reference 5 floor qq_39936465 reply:
Quote: refer to 4th floor qq_46466757 response:



Add a main method, the method to write the following statement, you don't have the main cannot perform, of course,

New LoginFrame ();

Main which bag can join the??

CodePudding user response:

refer to 6th floor qq_46466757 response:
main which bag can be added to the??


The main in the program is not important, do you want to run the window needs to be instantiated, also is that the new window class can be achieved, the key to see how you allocate,

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related