Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EventDispatch Exception

 
ghazanfar khan
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.
 
John Wetherbie
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic