I am building a desktop app with Swing with similar functionality to Twitter. I have a "feed" page where "tweets" are displayed.
I have the "tweets" in a JPanel and want to dynamically display new ones coming in by placing new "tweets" at the top of the JPanel and moving older ones down. I was trying to do this with MigLayout by using jpanel.add(tweet, "cell 0 0, wrap")
however this didn't work as intended and in order to get it to display with the layout I wanted I had to call jpanel.revalidate()
.
This is not ideal as there could be many tweets coming in every second and redrawing the panel can be quite slow. Is there anyway I can add new "tweets" to the top of the panel without redrawing?