Hi, Folks. Here's my problem. I have a JTable with a horizontal scrollbar. I refresh the data using a Timer(). When the app first comes up, it's scrolled to the left. If the user is scrolled to the right when the data refreshes, the whole screen is repainted and it ends up scrolled to the left. How do I refresh the data but stay on the same part of the screen? I tried using the fireTableDataChanged() method of the table model, but it didn't work. Can anyone out there help me? Thanks in advance!
maybe there is some better method to do it, but, well, try this: get the value of the horizontal scrollbar, update the value (+ maybe you have to wait until the table gets refreshed and the horizontal scrollbar reset to left), and then set the scrollbar value to the former value (changed by the user). The "better" possibility might be to either look for a method that sets a flag like "resetScrollbarOnUpdate()" though I haven't stumbled over a simimilar method until now. Or otherwise: Look through the source of javax.swing.JScrollPane, find the method where this behaviour is implemented and write a subclass that behaves as you like. hope that helps