• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

EventDispatch Exception  RSS feed

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have an application which frequently update and download its data from stock market, but when i pass the my table model in TableSorter it throws an eventdispatch excption, but the program wruns fine. i also calling invokeLater from my main class. Can anyone please help me why or can someone explain me wht is eventdispatch thread. I read some article on web but not get clear idea. Please help me out
thank you very much.
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to post your code so people can see exactly what is going on.
 
ghazanfar khan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks John for your reply, i am using TableSorter class from sun web site. It works fine when the i have static data, but i am getting data from the stock market, so it is changing, here is the link for tableSorter

private Row[] getViewToModel() {
if (viewToModel == null) {
int tableModelRowCount = tableModel.getRowCount();
viewToModel = new Row[tableModelRowCount];
for (int row = 0; row < tableModelRowCount; row++)
{
viewToModel[row] = new Row(row); <--THIS IS THE LINE
CAUSING THE EXCEPTION
}

if (isSorting()) {
Arrays.sort(viewToModel);
}
}
return viewToModel;
}

Why would a Null Pointer Exception be occurring here if we are assigning a value???

thanks in advance
[ January 03, 2006: Message edited by: ghazanfar khan ]
 
ghazanfar khan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have solved the problem, here is the solution we need to inform tableSorter by using Event Thread e.g

**********************************************************************
try{
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
tableModel.fireTableDataChanged();
}

});
}catch(InterruptedException ie){

}catch(InvocationTargetException te){

}

**********************************************************************
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you found the solution!
 
We can walk to school together. And we can both read this tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!