I have a Jpanel where i need to display a text taken from a file.
But i have to display the text word by word (one word per second). How can i do it?
I tried to override the paintComponent method but it can’t display text progressively..
I have a Jpanel where i need to display a text taken from a
Share
You are looking for Timer (the one in the swing package). Assuming you have the word-splitting part ready, the following pseudo-code snippet is an example of how to append them successively to a JTextArea:
If you really want to draw the String manually on a custom panel, let it have an append method and call that in your actionListener, something like