Here you can find the source of modelToView(final JTextComponent scrollableComponent, int pos)
private static Rectangle modelToView(final JTextComponent scrollableComponent, int pos)
//package com.java2s; import javax.swing.text.BadLocationException; import javax.swing.text.JTextComponent; import java.awt.*; public class Main { private static Rectangle modelToView(final JTextComponent scrollableComponent, int pos) { try {// ww w. j a v a2s.c o m return scrollableComponent.modelToView(pos); } catch (BadLocationException exception) { throw new RuntimeException(exception); } } }