boa tarde galera, to com um problema com o meu Projeto…
tava olhando ele, funcionamento tava 100%, so que eu resolvi dar uma enxugada, eliminar algumas linhas ou simplesmente diminuir a quantidade de imports utilizados
meu codigo, nao alterei nada na parte estrutural, so resolvi implementar os listeners no proprio metodo .addActionListener();, antes fiz tudo na unha, mas devido ao fato que tenho que utilizar Mouse e KeyListener resolvi dar uma enxugada pra nao ficar um codigo com mtos @Overrides
segue o cod:
comboModoGravacao.getButtonAdd().addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JCadModoGravacao gravacao = new JCadModoGravacao(true, getThis(), attTabela ); //attTabela é a minha Thread em execuçao
gravacao.setVisible(true);
}
});
a thread funciona blz, pois quando eu dou um System.out.println nela aparece isso, o que significa que a thred esta ativa:
Thread[Thread-3,6,main]
me deparei com o seguinte problema:
Exception occurred during event dispatching:
java.lang.NullPointerException
at sga.tela.principais.JCadComDoisCampos.paraThreadSuperior(JCadComDoisCampos.java:425)
at sga.tela.principais.JCadComDoisCampos.<init>(JCadComDoisCampos.java:46)
at sga.tela.extended.JCadModoGravacao.<init>(JCadModoGravacao.java:19)
at sga.tela.principais.JCadMidias$14.actionPerformed(JCadMidias.java:404)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
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:2475)
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.pumpEventsForFilter(EventDispatchThread.java:178)
at java.awt.Dialog$1.run(Dialog.java:1045)
at java.awt.Dialog$3.run(Dialog.java:1097)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1095)
at java.awt.Component.show(Component.java:1563)
at java.awt.Component.setVisible(Component.java:1515)
at java.awt.Window.setVisible(Window.java:841)
at java.awt.Dialog.setVisible(Dialog.java:985)
at sga.tela.principais.JCadMidias$1.run(JCadMidias.java:239)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
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)
Hibernate:
e ai nao sei como resolver, pq a thread esta viva esta viva…
se alguem puder ajudar!
agradeço!