Home > Back-end >  About JAVAGUI interface error, really confused about
About JAVAGUI interface error, really confused about

Time:11-20

Landing interface and function of login, if the user name "user", the password for "user" is the pop-up login dialog, success or fail to log in pop-up dialog box,

When finally click login will be out of this kind of mistake
 the Exception in the thread "is the AWT - EventQueue - 0" Java. Lang. NullPointerException 
The at JJC. DL $DLListener. ActionPerformed (DL) Java: 50)
The at javax.mail. Swing. AbstractButton. FireActionPerformed (AbstractButton. Java: 2022)
The at javax.mail. Swing. AbstractButton $Handler. The actionPerformed (AbstractButton. Java: 2348)
The at javax.mail. Swing. DefaultButtonModel. FireActionPerformed (DefaultButtonModel. Java: 402)
The at javax.mail. Swing. DefaultButtonModel. SetPressed (DefaultButtonModel. Java: 259)
The at javax.mail. Swing. Plaf. Basic. BasicButtonListener. MouseReleased (BasicButtonListener. Java: 252)
At java.awt.Com ponent. ProcessMouseEvent (Component. Java: 6533)
The at javax.mail. Swing. Jcomponents. ProcessMouseEvent (jcomponents. Java: 3324)
At java.awt.Com ponent. The processEvent (Component. Java: 6298)
The at Java. The awt. Container. The processEvent (Container. Java: 2236)
At java.awt.Com ponent. DispatchEventImpl (Component. Java: 4889)
The at Java awt. Container. DispatchEventImpl (Container. Java: 2294)
At java.awt.Com ponent. DispatchEvent (Component. Java: 4711)
The at Java awt. LightweightDispatcher. RetargetMouseEvent (Container. Java: 4888)
The at Java awt. LightweightDispatcher. ProcessMouseEvent (Container. Java: 4525)
The at Java awt. LightweightDispatcher. DispatchEvent (Container. Java: 4466)
The at Java awt. Container. DispatchEventImpl (Container. Java: 2280)
The at Java awt. Window. DispatchEventImpl (2746) the Window. The Java:
At java.awt.Com ponent. DispatchEvent (Component. Java: 4711)
The at Java awt. EventQueue. DispatchEventImpl (EventQueue. Java: 758)
At Java awt. EventQueue. Access the $500 (97) EventQueue. Java:
At Java awt. EventQueue $3. The run (709) EventQueue. Java:
At Java awt. EventQueue $3. The run (703) EventQueue. Java:
The at Java. Security. The AccessController. DoPrivileged (Native Method)
The at Java. Security. ProtectionDomain $JavaSecurityAccessImpl. DoIntersectionPrivilege (ProtectionDomain. Java: 80)
The at Java. Security. ProtectionDomain $JavaSecurityAccessImpl. DoIntersectionPrivilege (ProtectionDomain. Java: 90)
The at Java awt. EventQueue $4. The run (EventQueue. Java: 731)
The at Java awt. EventQueue $4. The run (EventQueue. Java: 729)
The at Java. Security. The AccessController. DoPrivileged (Native Method)
The at Java. Security. ProtectionDomain $JavaSecurityAccessImpl. DoIntersectionPrivilege (ProtectionDomain. Java: 80)
The at Java awt. EventQueue. DispatchEvent (EventQueue. Java: 728)
The at Java awt. EventDispatchThread. PumpOneEventForFilters (EventDispatchThread. Java: 201)
The at Java awt. EventDispatchThread. PumpEventsForFilter (EventDispatchThread. Java: 116)
The at Java awt. EventDispatchThread. PumpEventsForHierarchy (EventDispatchThread. Java: 105)
The at Java awt. EventDispatchThread. PumpEvents (EventDispatchThread. Java: 101)
The at Java awt. EventDispatchThread. PumpEvents (EventDispatchThread. Java: 93)
The at Java awt. EventDispatchThread. Run (EventDispatchThread. Java: 82)


This is a JAVA code
 package JJC. 

The import javax.mail. Swing. JButton;
The import javax.mail. Swing. JFrame;
The import javax.mail. Swing. JLabel;
The import javax.mail. Swing. JTextField;
Import the Java. The awt. TextField;
Import the Java. The awt. Event. An ActionEvent;
Import the Java. The awt. Event. ActionListener;

The import javax.mail. Swing. *;
Public class DL extends JFrame {
/* *
*
*/
Private static final long serialVersionUID=- 2918915622569706727 l;
TextField text, text2.
/* *
* @ param args
*/
Public DL () {
JTextField text=new JTextField (150);
JTextField text2=new JTextField (150);
JButton for=new JButton (" login ");
For the addActionListener (new DLListener ());
JLabel button2=new JLabel (" account ");
JLabel button3=new JLabel (" password ");
this.setLayout(null);
Enclosing setTitle (" user login ");
Text. SetBounds (100,50,120,30);
Text2. SetBounds (100100120, 30);
For the setBounds (100150100);
Button2. SetBounds (30,50,30,30);
Button3. SetBounds (30100,30,30);
This. The add (text);
This. The add (text2);
This. The add (for);
This. The add (button2);
This. The add (button3);
Enclosing setDefaultCloseOperation (EXIT_ON_CLOSE);
//window size
Enclosing setSize (300300);
The position of the window the//
Enclosing setLocation (600, 400);
this.setVisible(true);
}
The class DLListener implements ActionListener {
@ Override
Public void actionPerformed (an ActionEvent e) {
String s1=text. The getText ();
String s2=text2. GetText ();
String s3="user";
String s4="user";

If (s1) equals (s3) & amp; & S2. Equals (s4))
{
JOptionPane. ShowMessageDialog (null, "login succeeds", "note", JOptionPane. INFORMATION_MESSAGE);
}
The else {
JOptionPane. ShowMessageDialog (null, "login failed", "note", JOptionPane. INFORMATION_MESSAGE);
}
}
}

Public static void main (String [] args) {
//TODO Auto - generated method stub
The new DL ();

}

}


Be received to get a little,, can you help me answer my question is, thank you.

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related