public void resize(int columns) { if (columns > myWidth) { for (int i = myTabLength * (myWidth / myTabLength); i < columns; i += myTabLength) { if (i >= myWidth) { myTabStops.add(i); } } } else { Iterator<Integer> it = myTabStops.iterator(); while (it.hasNext()) { int i = it.next(); if (i > columns) { it.remove(); } } } myWidth = columns; }
@Override public void setTabStop(int position) { myTabStops.add(Integer.valueOf(position)); }
private void initTabStops(int columns, int tabLength) { for (int i = tabLength; i < columns; i += tabLength) { myTabStops.add(i); } }