Hi Adam & Michael,
Here's a (not particularly future-proof) solution with more code than
Michael's, but should work efficiently regardless of how much text is
present:
TextPanel textPanel = IJ.getTextPanel();
Component[] c = textPanel.getComponents();
for (int i=0; i<c.length; i++) {
if (c[i] instanceof Scrollbar) {
Scrollbar sb = (Scrollbar) c[i];
if (sb.getOrientation() == Scrollbar.VERTICAL) {
sb.setValue(0);
break;
}
}
}
-Curtis
On Tue, Dec 1, 2009 at 4:20 AM, Michael Schmid <
[hidden email]>wrote:
> Hi Adam,
>
> assuming you are programming a plugin, not a macro:
>
> The only idea that comes into my mind is not very elegant, but it should do
> what you want (I have not tried it, however). You could create a mouse wheel
> event that scrolls up a very large distance (999999 lines, or whatever you
> consider enough):
>
> TextPanel textPanel = IJ.getTextPanel();
> textPanel.mouseWheelMoved(new MouseWheelEvent(textPanel, 0, 0, 0, 0, 0, 0,
> false, MouseWheelEvent.WHEEL_UNIT_SCROLL, -999999, -999999);
>
> Michael
> ________________________________________________________________
>
>
> On 1 Dec 2009, at 06:27, Adam Cliffe wrote:
>
> Kind of a trivial macro writing problem....
>>
>> If there are say 100 results in the results table, running
>> updateResults(); refreshes the results table but also scrolls the
>> window down to the last entry.
>> does anyone know an easy way to set the part of the results table
>> shown in the window? (i.e. so the first result is visible).
>>
>> thanks
>>
>> Adam
>>
>