/** * Inserts a string. * * @param i i. * @param s s. * @param attributes the attributes. * * @throws BadLocationException ?? */ public void insertString(final int i, final String s, final AttributeSet attributes) throws BadLocationException { super.insertString(i, s, attributes); if (s != null && (!s.equals("-") || i != 0 || s.length() >= 2)) { try { Integer.parseInt(getText(0, getLength())); } catch (NumberFormatException e) { remove(i, s.length()); } } }
/** * Inserts a string. * * @param i i. * @param s s. * @param attributes the attributes. * * @throws BadLocationException ?? */ public void insertString(final int i, final String s, final AttributeSet attributes) throws BadLocationException { super.insertString(i, s, attributes); if (s != null && (!s.equals("-") || i != 0 || s.length() >= 2)) { try { Integer.parseInt(getText(0, getLength())); } catch (NumberFormatException e) { remove(i, s.length()); } } }
/** * Inserts a string. * * @param i i. * @param s s. * @param attributes the attributes. * * @throws BadLocationException ?? */ public void insertString(final int i, final String s, final AttributeSet attributes) throws BadLocationException { super.insertString(i, s, attributes); if (s != null && (!s.equals("-") || i != 0 || s.length() >= 2)) { try { Integer.parseInt(getText(0, getLength())); } catch (NumberFormatException e) { remove(i, s.length()); } } }