int selBegin = sourceTextArea.getLineStartOffset(srcLine.getStartLine()); int selEnd = sourceTextArea.getLineStartOffset(srcLine.getEndLine()+1); writeToConsole("Select " + selBegin + " to " + selEnd);
int selBegin = sourceTextArea.getLineStartOffset(srcLine.getStartLine() - 1); int selEnd = sourceTextArea.getLineStartOffset(srcLine.getEndLine());
    private void viewSource(Project project, AnalysisRun analysisRun, SourceLineAnnotation srcLine) {	sourceFinder.setSourceBaseList(project.getSourceDirList());	String sourceFile = analysisRun.getSourceFile(srcLine.getClassName());	if (sourceFile == null) {	    System.out.println("No source file for class " + srcLine.getClassName());	    return;	}		sourceTextArea.setText("");	bugTreeSourceViewSplitter.resetToPreferredSizes();	// Try to open the source file and display its contents	// in the source text area.	try {	    InputStream in = sourceFinder.openSource(srcLine.getPackageName(), sourceFile);	    BufferedReader reader = new BufferedReader(new InputStreamReader(in));	    	    String line;	    while ((line = reader.readLine()) != null) {		sourceTextArea.append(line + "\n");	    }	    	    reader.close();	} catch (IOException e) {	    logger.logMessage(ConsoleLogger.ERROR, e.getMessage());	    return;	}        // Highlight the lines from the source annotation        try {            int selBegin = sourceTextArea.getLineStartOffset(srcLine.getStartLine());            int selEnd = sourceTextArea.getLineStartOffset(srcLine.getEndLine()+1);            writeToConsole("Select " + selBegin + " to " + selEnd);            sourceTextArea.select(selBegin, selEnd);            sourceTextArea.getCaret().setSelectionVisible(true);        } catch (javax.swing.text.BadLocationException e) {            logger.logMessage(ConsoleLogger.ERROR, e.getMessage());        }    }