public void keyTyped(KeyEvent e) {
        if (curIndex < 0)
            curIndex = 0;
        if (curIndex > currentText.length())
            curIndex = currentText.length() - 1;
        currentText = new StringBuffer(currentText).replace(curIndex, curIndex + 1, "").toString();
        switch (e.getKeyChar()) {
            case KeyEvent.VK_BACK_SPACE:
                if (curIndex > 0) {
                    removeChar(curIndex - 1);
                }
                curIndex--;
                addChar("*".charAt(0), curIndex);
                break;

            case KeyEvent.VK_LEFT:
                removeChar(curIndex);
                curIndex--;
                addChar("*".charAt(0), curIndex);
                break;

            case KeyEvent.VK_RIGHT:
                removeChar(curIndex);
                curIndex++;
                addChar("*".charAt(0), curIndex);
                break;

            default:
                addChar(e.getKeyChar(), curIndex);
                curIndex++;
                addChar("*".charAt(0), curIndex);
                break;
        }
    }