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 (-1 != index)↵ | | 4 | if(-1 != index)↵
|
5 | {↵ | | |
|
6 | ↵ | | 5 | {↵
|
7 | if (index == text.length() - 1)↵ | | 6 | if (index == text.length() -1)↵
|
8 | {↵ | | |
|
9 | ↵ | | 7 | {↵
|
10 | text = text.substring(0, text.length() - 1); // truncate string↵ | | 8 | text = text.substring(0, text.length()-1); // truncate string↵
|
11 | }↵ | | |
|
12 | else↵ | | |
|
13 | {↵ | | |
|
14 | ↵ | | 9 | }↵
|
| | | 10 | else {↵
|
15 | text = text.substring(0, index) + text.substring(index + 1);↵ | | 11 | text = text.substring(0, index) + text.substring(index+1);↵
|
16 | ↵ | | 12 | }↵
|
17 | }↵ | | 13 | }↵
|
18 | ((IRestorableTextComponent) _theComponent).updateText(text);↵ | | 14 | ((IRestorableTextComponent)_theComponent).updateText( text);↵
|
19 | _beepHelper.beep(_theComponent);↵ | | 15 | _beepHelper.beep(_theComponent);↵
|
20 | e.consume();↵ | | 16 | e.consume();↵
|
21 | | | 17 | }
|