I've created a Table that is basically a JPanel
with other panels as rows containing JTextArea
components to display data. I didn't want to use a JTable
to have full control by myself.
When a row is clicked on I want it to be highlighted through changing its border. I implemented a Mouselistener
that does the job for every text area on mouse pressed. It works. It works with 1000 entries, but when I reach more, i.e. 5000 it takes ages for the listener to do his work. Obviously it gets worse the more entries I have. But this doesn't make sense to me, as I only change one rows border, no matter whether there is 1 or 10000 others.
Can anyone point me to the reason for this? Even if I put a System.out
right after "mouse pressed" it takes ages for the output. So I guess its not the executed methods (that are not time consuming at all) themselves.