public Ruler(final boolean vertical, ScrollPane scrollPane, final DocContext context) {
this.vertical = vertical;
this.context = context;
Scrollbar sp;
if(vertical) {
sp = scrollPane.getVerticalScrollBar();
} else {
sp = scrollPane.getHorizontalScrollBar();
}