Exception in thread "AWT-EventQueue-0" java.lang.​NullPointe​rException using CreateTable() / Java

64 次查看(过去 30 天)
Hi,
Is there anyone here who is using the Yair's CreateTable() function.
I used this function to embed two java tables into my GUI. I didn't use the standard GUI uitable simply because the latter one provides me more flexibitlies.
But if I close my GUI, then I get two red java errors in workspace, in format:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.mathworks.widgets.spreadsheet.SpreadsheetScrollPane.cleanup(SpreadsheetScrollPane.java:571) at com.mathworks.hg.peer.UitablePeer$3.run(UitablePeer.java:149) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Does anyone have a idea why this happens and how to solve this ?
By the way, I am not a java experts. How can I find out all the methods within a java (like jTable) object?
Thanks

回答(6 个)

Aleti venkatesh
Aleti venkatesh 2020-2-12
编辑:Aleti venkatesh 2020-2-12
I have a solution for that don't bother about that ..whenever encounter this type of error in matlab command window just you have to write this code ,which is shown in below...
opengl('save','software')
and then run the program again you have encounter same error ...
and then you just close matlab window and then open matlab freshly...
after that you run the program and code will be executed with out any errors.....
thank you.....
if you have any doubts please contact me via email....
this is my email id : venkydhoni2@gmail.com

John Libert
John Libert 2012-3-15
I get this same error, and most of the time MATLAB locks up. It generally happens when MATLAB is open overnight. I have never seen it while I am working. This should be looked at by tech support as I have lost data during big overnight runs.
  3 个评论
Alistair
Alistair 2013-5-5
I also get a similar error, which just starts repeatedly and continuously printing to the matlab command line. This happens only when I leave Matlab open and it's inactive, not processing data for a few hours -- I come back and its spewing
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
repeatedly.
Aleti venkatesh
Aleti venkatesh 2020-2-12
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
I have solution for that don't bother about that ..whenever encounter this type of error in matlab command window just you have to write this code ,which is shown in below...
opengl('save','software')
and then run the program again you have encounter same error ...
and then you just close matlab window and then open matlab freshly...
after that you run the program and code will be executed with out any errors.....
thank you.....
if you have any doubts please contact me via email....
this is my email id : venkydhoni2@gmail.com

请先登录,再进行评论。


Thulasi Durai Durai Samy
I too have the same problem can some one support me also

Jeffery Devereux
Jeffery Devereux 2018-1-11
Same problem here...

Jeffery Devereux
Jeffery Devereux 2018-1-11
I am going to try adding this to my code to catch the error before it crashes my program. It only happens when I leave it running all night.
%Have some Java javaControl = javaObjectEDT('javax.swing.JFrame'); pause(0.05); drawnow; % this never hurt anyone! fprintf(' \b');

Ondrej
Ondrej 2022-4-10
What worked for me was to replace the line
tab.TableScrollPane.setRowHeader('');
with
tab.TableScrollPane.setRowHeaderView(javax.swing.JLabel(''))
Then no more "AWT-EventQueue-0" exceptions when closing the uitable.

类别

Help CenterFile Exchange 中查找有关 Dialog Boxes 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by