| Author |
AutoScroll text to bottom of a StyledText component in SWT
|
ragz wifer
Greenhorn
Joined: Dec 22, 2010
Posts: 20
|
|
Hi,
I'm reading a text file and displaying in the styledtext component of SWT, each time a new line is appended it's not shown, i mean the line is added to the next row but the scrollbar is NOT scrolling to the next row.
How can i make it auto scroll, as a workaround i tried using it do auto scroll,but shows the complete selection which is nasty, can someone provide an optimal and better programming practice for this case.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
In Swing you can set the caret position to the end of the document. Is that not possible in SWT as well?
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
ragz wifer
Greenhorn
Joined: Dec 22, 2010
Posts: 20
|
|
Rob Spoor wrote:In Swing you can set the caret position to the end of the document. Is that not possible in SWT as well?
how do i set caret position any example
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
|
JTextComponent#setCaretPosition(int positon) This is inherited by the children
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
ragz wifer
Greenhorn
Joined: Dec 22, 2010
Posts: 20
|
|
Maneesh Godbole wrote:JTextComponent#setCaretPosition(int positon) This is inherited by the children
Maneesh this is not swings
anyways
i found absolute answer to my question i.e..,
my attempts 1) styledText.selectAll();//moves the autoscroll down but selects all..--not preferrable 2) styledText.setSelection(styledText.getCharacterCount());//works for me
gratitude to all for the above answers.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
ragz wifer wrote:this is not swings
Swing is a proper noun.
|
 |
 |
|
|
subject: AutoScroll text to bottom of a StyledText component in SWT
|
|
|