Tuesday, April 15, 2008

Text project progressing

Still working on the text simulation thing, which, again, is meant more to expand my knowledge than to be practical or useful. Newest development: all basic text keys are usable (including letters, numbers, and single-keystroke punctuation and symbols).
I also figured out how to work with a backspace function - it was just simpler than I had expected. The code looks something like:

Switch (keycode) ** which works like an if clause**
{

case KeyEvent VK_BACK_SPACE: **activates when backspace is used**

welcomeJTextArea.replaceRange( **this tells it to replace
"", welcomeJTextArea.getText().length - 1, the text in the previous
welcomeJTextArea.getText().length ); spot with a blank**

blinkx -= 17; **moves the cursor back**
break; **ends the statement**

I also simplified the code that activates for each keystroke by consolidating the "blinkx += 17" statements (which move the cursor forward) into one statement.

1 comment:

GeekTeach said...

Hey!
Nice very specific entry. I know exactly what you are referring to after seeing the presentation. Since only you have your computer, that's how I must find out.

Keep it going - all good,
~Richard.