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