1 | if (c == KeyEvent.VK_TAB || c == KeyEvent.VK_ENTER) {↵ | | 1 | if (c == KeyEvent.VK_TAB || c == KeyEvent.VK_ENTER) {↵
|
2 | // remove all instances of the offending char↵ | | 2 | // remove all instances of the offending char↵
|
3 | int index = text.indexOf(c);↵ | | 3 | int index = text.indexOf(c);↵
|
4 | if (index != -1) {↵ | | 4 | if↵
|
5 | ↵ | | 5 | (-1 != index)↵
|
| | | 6 | {↵
|
6 | if (index == text.length() -1) {↵ | | 7 | if (index == text.length() -1) {↵
|
7 | text = text.substring(0, text.length()-1); // truncate string↵ | | 8 | text = text.substring(0, text.length()-1); // truncate string↵
|
8 | }↵ | | 9 | }↵
|
9 | else {↵ | | 10 | else {↵
|
10 | text = text.substring(0, index) + text.substring(index+1);↵ | | 11 | text = text.substring(0, index) + text.substring(index+1);↵
|
11 | }↵ | | 12 | }↵
|
12 | ↵ | | 13 | }↵
|
13 | ((IRestorableTextComponent)_theComponent).updateText( text);↵ | | 14 | ((IRestorableTextComponent)_theComponent).updateText( text);↵
|
14 | _beepHelper.beep(_theComponent);↵ | | 15 | _beepHelper.beep(_theComponent);↵
|
15 | }↵ | | |
|
16 | e.consume();↵ | | 16 | e.consume();↵
|
17 | } | | 17 | }
|