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