Olá galera…
eu estou precisando usar uma tabela em meu programa, e fiz um só de teste para saber e entender como que funcionar…
Mas estou tendo problemas para PEGAR o que tem em tal celula…
Estou usando a função: getValueAt(lin, col)
Segue o Codigo da parte que dá o erro:
private void jButton1MouseReleased(java.awt.event.MouseEvent evt)
{
String selecionado = matriz.getValueAt(1,1).toString();
System.out.println("celula-->"+selecionado);
}
O erro ocorre, quando eu seleciono a celula, digito alguma coisa e clico no botão que faz esse action…
Se eu escrevo na celula (1,1) e depois mudo de celula, não ocorre problema…
O problema é esse erro de:
java.lang.NullPointerException
at matrix.jButton1MouseReleased(matrix.java:68)
at matrix.access$100(matrix.java:2)
at matrix$2.mouseReleased(matrix.java:26)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Fico no aguardo!!!
abraços
ceará
