Ahora tengo otro problema cuando hago mi JAR se abre una pantalla negra y se cierra
¿A qué se debe?
Me aparece esto:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at seiem.Login.<init>(Login.java:24)
at seiem.Login$3.run(Login.java:181)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
CLASE LOGIN:
package seiem;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
public class Login extends javax.swing.JFrame {
public static final String URL="jdbc:mysql://localhost:3306/CEDULA";
public static final String Usuario="root";
public static final String Contraseña="12345678";
public Login() {
initComponents();
setLocationRelativeTo(null);
setResizable(false);
setIconImage(new ImageIcon(getClass().getResource("/Seiem/logo.png")).getImage());
((JPanel)getContentPane()).setOpaque(false);
ImageIcon MyImgCustom=new ImageIcon(this.getClass().getResource("/Seiem/seiem.jpg"));
JLabel fondo=new JLabel();
fondo.setIcon(MyImgCustom);
getLayeredPane().add(fondo,JLayeredPane.FRAME_CONTENT_LAYER);
fondo.setBounds(0,0,MyImgCustom.getIconWidth(),MyImgCustom.getIconHeight());
}
private void IngresarActionPerformed(java.awt.event.ActionEvent evt) {
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con= (Connection) DriverManager.getConnection(URL, Usuario, Contraseña);
JOptionPane.showMessageDialog(null,"Bienvenido al sistema");
CedulaIdentificacion abrir=new CedulaIdentificacion();
abrir.setVisible(true);
}catch(Exception e){
System.out.println(e);
}
}
private void CancelarActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}