我的以下代码在从 NetBeans IDE 运行时运行良好
public Selector() {
try {
if (count == 0) {
initComponents();
count++;
ims.CPool.configureConnPool();
fillTable();
setResizable(false);
Dimension Size = Toolkit.getDefaultToolkit().getScreenSize();
setLocation(new Double((Size.getWidth() / 2) - (getWidth() / 2)).intValue(), new Double((Size.getHeight() / 2) - (getHeight() / 2)).intValue());
jTable1.addMouseListener(this);
img = ImageIO.read(Selector.class.getResource("/ims/Icons/login.png"));
sci = img.getScaledInstance(jLabel3.getWidth(), jLabel3.getHeight(), java.awt.Image.SCALE_SMOOTH);
ImageIcon newIconImage = new javax.swing.ImageIcon(sci);
jLabel3.setIcon(newIconImage);
} else {
throw new myExc("Only one instance of the application is allowed to run at a time !");
}
} catch (HeadlessException | IOException | myExc x) {
x.printStackTrace();
JOptionPane.showMessageDialog(null,x.getMessage());
}
}
每当我尝试启动具有上述构造函数的类时,都会出现如下所示的异常
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: input
== null!
at javax.imageio.ImageIO.read(Unknown Source)
at ims.init.Selector.<init>(Selector.java:60)
at ims.init.Selector$8.run(Selector.java:502)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(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$1.doIntersectionPrivilege(Unknown Sour
ce)
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)
请帮忙