private void printAndUpdateIndex( DrawHandler drawer, RelationPointHandler relationPoints, PointDouble pointText, int index, String text, Set<Integer> usedIndexes) { drawer.print(text, pointText, AlignHorizontal.LEFT); // to make sure text is printed (and therefore withing relation-element-borders, resize relation // according to text relationPoints.setTextBox( index, new Rectangle( pointText.getX(), pointText.getY() - drawer.textHeightMax(), drawer.textWidth(text), drawer.textHeightMax())); usedIndexes.add(index); }