Disable backspace in Java
<p>I am creating a typing program in which the user types a series of characters, but must do so without any errors. While typing, the user <em>can</em> backspace in a word, but the backspace option ends when they press the space bar (moving on to a new word).</p>

<p>Here is my current code:</p>

<pre><code>public synchronized void backSpace(){
    if (ttext.length() &gt; 0) {
        ttext = ttext.substring(0, ttext.length() - 1);
    } else {
        typetext.append(" ");
    }
}
</code></pre>

<p>What I am looking for is a way to <em>disable the backspace function</em> so that the user can no longer edit what they have typed.</p>
