我刚刚尝试将一个 NetBeans 项目合并到一个 Eclipse 项目中(javaSE-1.6)。然而,这两个 IDE 之间存在差异。总的来说,我试图通过网络摄像头实现二维码扫描。我得到的只是空指针异常,我怀疑它是由以下代码引起的。基本上我有 3 个 JLabels 和一个按钮。在不使用 'org.openide.util.NbBundle' 的情况下,我如何做一个解决方法来使其工作?
JLabel scannerScreen = new JLabel("connecting to camera");
scannerScreen.setBounds(72, 50, 274, 205);
//suspected erroneous code at following line
//org.openide.awt.Mnemonics.setLocalizedText(scannerScreen, org.openide.util.NbBundle.getMessage(ScannerUI.class, "ScannerPanel.scannerScreen.text")); // NOI18N
panel.add(scannerScreen);
JLabel lblNewLabel_1 = new JLabel("Welcome ");
lblNewLabel_1.setBounds(72, 11, 274, 58);
panel.add(lblNewLabel_1);
//suspected erroneous code at following line
//org.openide.awt.Mnemonics.setLocalizedText(nextScan, org.openide.util.NbBundle.getMessage(ScannerUI.class, "ScannerPanel.nextScan.text")); // NOI18N
JButton nextScan = new JButton("Next Scan");
nextScan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{
nextScanActionPerformed(evt);
}
});
nextScan.setBounds(72, 266, 89, 23);
panel.add(nextScan);