Hi All, i m working on a jtable which shows live stock quotes. the data is coming from a text file and i have the Obeserver running seperately, connected to my main applet class which notifies the applet whenever any updation occurs on the text file.
i've connected the TableSorter with my Tablemodel and set its tableheader and all in the init() method as usual but the problem arrises once i received a notification from the observer.
in my update method in the applet class, i first gets the data from the tablesorter (incase user have changed the view of the table based on any column) and then call my tablemodel to get the data from the file that has been updated........ then i sort my table model according to the data gathered from the tablesorter.........meaning if the file contains records of 3 companies (IBM,CMD,HSB)... and a user have clicked on the table column to sort it alphabetically, i want data to be sorted alphabetically in the model as well (CMD, HSB,IBM ).
Also, i have created a new CustomRenderer to show relevent colors according to the status of quotes. for that i call my CustomRenderer constructor with the TableSorter data gathered previously to update its private vector and check the incoming values with the values in the vector when getTableCellRendererComponent method is called.
it all works fine except whenever any update occurs on the text file, the jtable change its table header as it was previously which is annoying for a user.