Perry Smith

Java Questions & Answers

Home / Java Q & A Archive Page 1 / Java Q & A Archive / Java Q & A Main Page

9-19-98

Delay/Waiting

      Newbie type question :
      If I want text to type out slowly in a textarea (typewriter effect) how do I get java
      to "wait/delay" between outputting eash char??

      wmiller

Re: Delay/Waiting

9-29-98

An implementation I was thinking about would involve the person typing in a small textArea and then dispatching that keyboard event to another textArea after a small amount of time. The problem with that is, of course, that the person's output may be visible immediately after they type it, although it will have that typewriter effect show up on the other textArea. I was thinking about ways to conceal the textArea they are actually typing in by making the foreground color equal to the background color in that textArea, and then it would show up in that other textArea, after you've dispatched the event to it. I haven't been able to think up any ways to have the typewriter effect occur in the same textArea the user is typing in, although it may be as simple as including some sort of wait in the KeyEventListener, but I don't think it is that simple. This would make for an interesting little app that I probably will try to code up later, but for now, I have other things to do, so I'll give you my train of thought on it.

Normally, when I'm not sure whether an approach will work or not, I actually try to compile some code, but I'm currently too deeply engrossed in another project to try.

MikeD


Home / Java Q & A Archive Page 1 / Java Q & A Archive / Java Q & A Main Page