Example usage for javax.swing.text BadLocationException printStackTrace

List of usage examples for javax.swing.text BadLocationException printStackTrace

Introduction

In this page you can find the example usage for javax.swing.text BadLocationException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:rita.widget.SourceCode.java

public void highlightCode(int line, int col) {

    try {//from www .  j a v  a2  s.com
        // Convertir a una posicion X/Y

        paneJavaCode.getHighlighter().addHighlight(paneJavaCode.getLineStartOffset(line - 1),
                paneJavaCode.getLineEndOffset(line - 1), new DefaultHighlightPainter(ErrorLineColor));
    } catch (BadLocationException e) {
        e.printStackTrace();
    }

}

From source file:rita.widget.SourceCode.java

public void highlightCode(RenderableBlock renderableBlock) {
    try {/*from   w w w  .j a v a  2s.  c o  m*/
        paneJavaCode.getHighlighter().removeAllHighlights();
        int startPos = 0;
        // encontrar la posicion en funcion del numero de repeticion del
        // LABEL
        String labelToFind = renderableBlock.getBlock().getBlockLabel();
        for (int i = 0; i < renderableBlock.getLabelInstanceNumber(); i++) {
            if (startPos > 0)
                startPos += labelToFind.length();
            startPos = paneJavaCode.getText().indexOf(labelToFind, startPos);
        }

        int lastPos = startPos + renderableBlock.getBlock().getBlockLabel().length();
        paneJavaCode.getHighlighter().addHighlight(startPos, lastPos,
                new DefaultHighlightPainter(Color.ORANGE));
    } catch (BadLocationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}