Package javax.swing.text

Examples of javax.swing.text.BadLocationException


    }

    private int  checkLineCount(final int line) throws BadLocationException {
        int count = getDocument().getDefaultRootElement().getElementCount();
        if (line < 0) {
            throw new BadLocationException(Messages.getString("swing.3E"), line); //$NON-NLS-1$
        }
        if (line >= count) {
            throw new BadLocationException(Messages.getString("swing.3F"), line); //$NON-NLS-1$
        }
        return count;
    }
View Full Code Here


    public int getLineOfOffset(final int offset) throws BadLocationException {
        Document doc = getDocument();
        int length = doc.getLength();
        if (offset < 0 || offset > length) {
            throw new BadLocationException(Messages.getString("swing.40"), //$NON-NLS-1$
                    offset);
        }
        readLock(doc);
        int index = 0;
        try {
View Full Code Here

        }
    }

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

    public static void isPositionValid(final View view, final int pos)
        throws BadLocationException {

        if (pos < view.getStartOffset() || pos > view.getEndOffset()) {
            // awt.2E={0} not in range {1},{2}
            throw new BadLocationException(Messages.getString("awt.2E", //$NON-NLS-1$
                    new Object[] { pos, view.getStartOffset(),
                            view.getEndOffset() }), pos);
        }
    }
View Full Code Here

    public Object addHighlight(final int p0, final int p1)
       throws BadLocationException {
        if (p0 < 0 || p1 < p0 || p1 > getDocumentLength()) {
            // awt.29=Invalid range
            throw new BadLocationException(Messages.getString("awt.29"), 0); //$NON-NLS-1$
        }
        start = document.createPosition(p0);
        end = document.createPosition(p1);
        repaintComponent(TextUtils.getBoundsByOffsets(textKit, p0, p1));
        return Boolean.TRUE;
View Full Code Here

    public void changeHighlight(final int p0, final int p1)
       throws BadLocationException {
        if (p0 < 0 || p1 < p0 || p1 > getDocumentLength()) {
            // awt.29=Invalid range
            throw new BadLocationException(Messages.getString("awt.29"), 0); //$NON-NLS-1$
        }
        int oldStart = getStartOffset();
        int oldEnd = getEndOffset();
        start = document.createPosition(p0);
        end = document.createPosition(p1);
View Full Code Here

    }

    private int  checkLineCount(final int line) throws BadLocationException {
        int count = getDocument().getDefaultRootElement().getElementCount();
        if (line < 0) {
            throw new BadLocationException(Messages.getString("swing.3E"), line); //$NON-NLS-1$
        }
        if (line >= count) {
            throw new BadLocationException(Messages.getString("swing.3F"), line); //$NON-NLS-1$
        }
        return count;
    }
View Full Code Here

    public int getLineOfOffset(final int offset) throws BadLocationException {
        Document doc = getDocument();
        int length = doc.getLength();
        if (offset < 0 || offset > length) {
            throw new BadLocationException(Messages.getString("swing.40"), //$NON-NLS-1$
                    offset);
        }
        readLock(doc);
        int index = 0;
        try {
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

    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

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.