i faced a problem with null , i implement the same code before and it work well but after i add other codes its not work ..
this is part of error :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at manager.flyer$13.mouseClicked(flyer.java:751)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
at java.awt.Component.processMouseEvent(Component.java:6536)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
and my code part which show that error :
JButton btnNewButton_4 = new JButton("Add All");
btnNewButton_4.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
int columnContainingPlanets =1 ;
for (int index =0 ; index < tableModel.getRowCount(); index ++){
if (tableModel.getValueAt(index, columnContainingPlanets).equals("")) {
JOptionPane.showMessageDialog(panel_4, "Please Enter Discount Amount For All Items");
return; }}
i try to replace columnContainingPlanets=1
to columnContainingPlanets=0
but also there is error : java.lang.NullPointerException
i will happy if any one know the solution because that error appeared suddenly, and it was work well ..