• Post Reply Bookmark Topic Watch Topic
  • New Topic

Auto type string in JLabel  RSS feed

 
Jae Jarabe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys i want to have a JLabel that could "robotically" type words character by character.
 
Jae Jarabe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What should I do with this aspose?
 
Campbell Ritchie
Marshal
Posts: 55786
164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.
Why a label? What is wrong with one of the text components? How do you think you are going to do it?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jae Jarabe wrote:Hi guys i want to have a JLabel that could "robotically" type words character by character.


Do you mean simulate typing on the screen?
1) If yes then your requirement can be abstracted to appending/replacing existing text
with
2) a sufficient visual delay in between so as to simulate typing.

For #1 you would have to zero in on the component you wish to use (as Campbell rightly pointed out, you can use more than just a label)
For #2 you would need a delaying mechanism. The easiest is probably Thread.sleep(). Have you worked with threads before?

 
Campbell Ritchie
Marshal
Posts: 55786
164
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thread.sleep() in Swing? surely you are better off with a Swing timer?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Thread.sleep() in Swing? surely you are better off with a Swing timer?

True. However I was trying to avoid needlessly clouding the issue with hung UI and EDT...

Ok. Whom am I trying to fool here. I was not really thinking things through and as usual Campbell is correct!
@Jae Swing timer is indeed the correct approach
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!