Java Code Examples for javax.swing.text.InternationalFormatter

The following examples show how to use javax.swing.text.InternationalFormatter. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   Source File: FormatSelector.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns format's pattern. 
 * 
 * @return format's pattern.
 */
public String getFormat() {
    if (format != null) return format;
    String fmt = null;
    if (formatter instanceof MaskFormatter) {
        fmt = ((MaskFormatter)formatter).getMask();
    } else if (formatter instanceof InternationalFormatter) {
        Format f = ((InternationalFormatter)formatter).getFormat();
        if (f instanceof DecimalFormat) {
            fmt = ((DecimalFormat)f).toPattern();
        } else if (f instanceof SimpleDateFormat) {
            fmt = ((SimpleDateFormat)f).toPattern();
        }
    }
    return fmt;
}
 
Example 2
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 3
Source Project: dragonwell8_jdk   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 4
Source Project: TencentKona-8   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 5
Source Project: TencentKona-8   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 6
Source Project: jdk8u60   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 7
Source Project: jdk8u60   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 8
Source Project: openjdk-jdk8u   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 9
Source Project: openjdk-jdk8u   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 10
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 11
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 12
Source Project: openjdk-jdk9   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or -1 if
 * there is no valid calendar field under the selection (or the spinner
 * isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) {
        return -1;
    }

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor) editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) {
        return -1;
    }

    final Format.Field[] fields = ((InternationalFormatter) formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) {
            continue;
        }
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field) element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 13
Source Project: openjdk-jdk9   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 14
Source Project: jdk8u-jdk   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 15
Source Project: jdk8u-jdk   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 16
Source Project: hottub   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 17
Source Project: hottub   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 18
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 19
Source Project: openjdk-8-source   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 20
Source Project: openjdk-8   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 21
Source Project: openjdk-8   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 22
Source Project: jdk8u_jdk   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 23
Source Project: jdk8u_jdk   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 24
Source Project: jdk8u-jdk   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 25
Source Project: jdk8u-jdk   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}
 
Example 26
Source Project: jdk8u-dev-jdk   Source File: AquaSpinnerUI.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the calendarField under the start of the selection, or
 * -1 if there is no valid calendar field under the selection (or
 * the spinner isn't editing dates.
 */
private int getCalendarField(final JSpinner spinnerComponent) {
    final JComponent editor = spinnerComponent.getEditor();
    if (!(editor instanceof JSpinner.DateEditor)) return -1;

    final JSpinner.DateEditor dateEditor = (JSpinner.DateEditor)editor;
    final JFormattedTextField ftf = dateEditor.getTextField();
    final int start = ftf.getSelectionStart();
    final JFormattedTextField.AbstractFormatter formatter = ftf.getFormatter();
    if (!(formatter instanceof InternationalFormatter)) return -1;

    final Format.Field[] fields = ((InternationalFormatter)formatter).getFields(start);
    for (final Field element : fields) {
        if (!(element instanceof DateFormat.Field)) continue;
        int calendarField;

        if (element == DateFormat.Field.HOUR1) {
            calendarField = Calendar.HOUR;
        } else {
            calendarField = ((DateFormat.Field)element).getCalendarField();
        }

        if (calendarField != -1) {
            return calendarField;
        }
    }
    return -1;
}
 
Example 27
Source Project: jdk8u-dev-jdk   Source File: Test6462562.java    License: GNU General Public License v2.0 5 votes vote down vote up
public TestFormattedTextField(InternationalFormatter fmt) {
    super(fmt);
    fmt.setAllowsInvalid(false);
    fmt.setOverwriteMode(true);

    backspace = getActionMap().get(DefaultEditorKit.deletePrevCharAction);
    delete = getActionMap().get(DefaultEditorKit.deleteNextCharAction);
    insert = getActionMap().get(DefaultEditorKit.insertContentAction);
    dummyEvent = new ActionEvent(this, 0, null);
}