Package javax.swing.text

Examples of javax.swing.text.BadLocationException


            throws BadLocationException {
        if (pos < 0) {
            throw new RuntimeException(Messages.getString("swing.A2")); //$NON-NLS-1$
        }
        if (pos > doc.getLength()) {
            throw new BadLocationException(Messages.getString("swing.98"), pos); //$NON-NLS-1$
        }
        if (doc.getLength() != 0) {
            Element body = doc.getElement(doc.getDefaultRootElement(),
                                          StyleConstants.NameAttribute,
                                          HTML.Tag.BODY);
View Full Code Here


  public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
    if (getLength() + str.length() <= maxLength) {
      super.insertString(offs, str, a);
    } else {
      throw new BadLocationException("Too long", offs);
    }
  }
View Full Code Here

    public void insertHTML(final HTMLDocument doc, final int offset,
                           final String html, final int popDepth,
                           final int pushDepth, final HTML.Tag insertTag)
            throws BadLocationException, IOException {
        if (offset > doc.getLength()) {
            throw new BadLocationException(Messages.getString("swing.98"), offset); //$NON-NLS-1$
        }

        ParserCallback htmlReader = doc.getReader(offset, popDepth,
                                                  pushDepth, insertTag);
        StringReader in = new StringReader(html);
View Full Code Here

            throws BadLocationException {
        if (pos < 0) {
            throw new RuntimeException(Messages.getString("swing.A2")); //$NON-NLS-1$
        }
        if (pos > doc.getLength()) {
            throw new BadLocationException(Messages.getString("swing.98"), pos); //$NON-NLS-1$
        }
        if (doc.getLength() != 0) {
            Element body = doc.getElement(doc.getDefaultRootElement(),
                                          StyleConstants.NameAttribute,
                                          HTML.Tag.BODY);
View Full Code Here

    public void insertHTML(final HTMLDocument doc, final int offset,
                           final String html, final int popDepth,
                           final int pushDepth, final HTML.Tag insertTag)
            throws BadLocationException, IOException {
        if (offset > doc.getLength()) {
            throw new BadLocationException(Messages.getString("swing.98"), offset); //$NON-NLS-1$
        }

        ParserCallback htmlReader = doc.getReader(offset, popDepth,
                                                  pushDepth, insertTag);
        StringReader in = new StringReader(html);
View Full Code Here

            throws BadLocationException {
        if (pos < 0) {
            throw new RuntimeException(Messages.getString("swing.A2")); //$NON-NLS-1$
        }
        if (pos > doc.getLength()) {
            throw new BadLocationException(Messages.getString("swing.98"), pos); //$NON-NLS-1$
        }
        if (doc.getLength() != 0) {
            Element body = doc.getElement(doc.getDefaultRootElement(),
                                          StyleConstants.NameAttribute,
                                          HTML.Tag.BODY);
View Full Code Here

        }
        return iteratorWordStart;
    }

    private static void throwException(final String s, final int i) throws BadLocationException {
        throw new BadLocationException(s, i);
    }
View Full Code Here

            try {
                if (doc.getText(start, 1).charAt(0) != ' ') {
                break;
                }
            } catch (BadLocationException ex) {
                throw (BadLocationException) new BadLocationException(
                        "calling getText(" + start + ", " + (start + 1) +
                        ") on doc of length: " + doc.getLength(), start).initCause(ex);
            }
            start++;
        }
View Full Code Here

  }

  private int getOffsetY(int rowStartOffset, FontMetrics fontMetrics) throws BadLocationException {
    Rectangle r = codeArea.modelToView(rowStartOffset);
    if (r == null) {
      throw new BadLocationException("Can't get Y offset", rowStartOffset);
    }
    int lineHeight = fontMetrics.getHeight();
    int y = r.y + r.height;
    int descent = 0;
    if (r.height == lineHeight) {
View Full Code Here

            newLength = fb.getDocument().getLength()-length+ (str == null ? 0 : str.length());
      }
        if (newLength <= maxSize) {
            fb.replace(offset, length, str, attrs);
        } else {
            throw new BadLocationException("New characters exceeds max size of document", offset);
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.BadLocationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.