| Author |
EventDispatch Exception
|
ghazanfar khan
Ranch Hand
Joined: Apr 18, 2005
Posts: 81
|
|
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
Joined: Apr 05, 2000
Posts: 1441
|
|
|
You may want to post your code so people can see exactly what is going on.
|
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
|
 |
ghazanfar khan
Ranch Hand
Joined: Apr 18, 2005
Posts: 81
|
|
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
Joined: Apr 18, 2005
Posts: 81
|
|
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
Joined: Apr 05, 2000
Posts: 1441
|
|
|
Glad you found the solution!
|
 |
 |
|
|
subject: EventDispatch Exception
|
|
|