Just like that
I guess it's a Swing app?
Make a JPanel, put a Timer on it which on every tick rotates the text in a StringBuffer one character (or however much) and sets it to a JLabel on that JPanel.
Add the assembly to your application and turn on the timer.
I used a JLabel, and deleted the first character and added it on the end of the text. Then the thread did the rest. It was kind of cool, bu not as hard as I expected.
If you use a single String you may want to check your performance and memory usage.
Could get substantial as Strings are immutable and thus a new String is being created for each iteration.
YOUR RIGHT! I didn't even think of that, and I was wondering why it was kind of jumpy, or seemed laggy. I'll change it to a BufferedString and get back to you on the physically visable performance. Anyways, thank you for pointing that out.
Is there a way I can some how work the StringBuffer in this method, because I'm using substrings, and I guess that would contribute to a performance loss.
One way would be to build an array of characters when setting the text and building up a stringbuffer based on the content of that array (keeping the current index of the first character in memory) during each iteration.
You can then simply call toString() on the StringBuffer in order to set the text.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.