in src/org/pushingpixels/lightbeam/panels/BigTextAreaPanel.java [63:113]
public PerformanceScenario getLargeScrollScenario() {
return new PerformanceScenario() {
int[] perms;
@Override
public String getName() {
return "Scrolling large text area";
}
@Override
public void setup() {
int lineCount = 1000;
textArea.setText("");
Random seed = new Random(10000);
for (int i = 0; i < lineCount; i++) {
StringBuffer line = new StringBuffer();
for (int j = 0; j < 10; j++) {
line.append(LightBeamUtils.dictionary[seed
.nextInt(LightBeamUtils.dictionary.length)]);
line.append(" ");
}
textArea.append(line.toString() + "\n");
}
textArea.scrollRectToVisible(new Rectangle(0, 0, textArea
.getWidth(), 10));
textArea.select(0, 0);
this.perms = LightBeamUtils.getPermutation(textArea
.getLineCount(), this.getIterationCount());
}
@Override
public int getIterationCount() {
return 10;
}
@Override
public void runSingleIteration(int iterationNumber) {
try {
int lineToScrollTo = this.perms[iterationNumber];
int charToScrollTo = textArea
.getLineStartOffset(lineToScrollTo);
textArea.scrollRectToVisible(textArea
.modelToView(charToScrollTo));
paintImmediately(0, 0, getWidth(), getHeight());
} catch (BadLocationException ble) {
ble.printStackTrace();
}
}
};
}