Click on JCheckBox in JTable gets me a NullPointerException

Hi everyone,
The subject says almost everything : I have a JTable with one colum with check boxes and another one with combo boxes. When I select a check box the value of the combo box of the same line is updated but for some reason I get the following exception :
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
     at javax.swing.plaf.basic.BasicTableUI$Handler.setValueIsAdjusting(BasicTableUI.java:923)
     at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1136)
     at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:273)
     at java.awt.Component.processMouseEvent(Component.java:6263)
     at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
     at java.awt.Component.processEvent(Component.java:6028)
     at java.awt.Container.processEvent(Container.java:2041)
     at java.awt.Component.dispatchEventImpl(Component.java:4630)
     at java.awt.Container.dispatchEventImpl(Container.java:2099)
     at java.awt.Component.dispatchEvent(Component.java:4460)
     at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
     at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
     at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
     at java.awt.Container.dispatchEventImpl(Container.java:2085)
     at java.awt.Window.dispatchEventImpl(Window.java:2478)
     at java.awt.Component.dispatchEvent(Component.java:4460)
     at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
     at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
The updating of the combo box column is done as following :
          final int row = evt.getLastRow();
          if ( (Boolean) this.table.getValueAt(row, CHECKBOX_COL) ) {
               final Object o = // some non-null object
               this.table.setValueAt(o, row, COMBOBOX_COL);
          this.table.repaint(0);
The object o is one of the items stored by the combo box so no inconsistency on that side.
Any help welcome !
Julien

I can't provide a SSCCE because of the numerous non-free libraries I'm using.
Anyway, here's what I found out so far :
As the StackTrace tells us the method that throws the exception is setValueIsAdjusting
        private void setValueIsAdjusting(boolean flag) {
            table.getSelectionModel().setValueIsAdjusting(flag);
            table.getColumnModel().getSelectionModel().
                    setValueIsAdjusting(flag);
        }Here table is null, which obviously throws the exception. It has been set to null by calling the BasicTableUI.uninstallUI method.
So my questions are :
Why would the uninstallUI method be called before the other calls ?
Is there a way to controll the calls to this method ?
Is there a way to get the setValueIsAdjusting method to be called before ?
regards
Julien

Similar Messages

Maybe you are looking for