JscrollBar problem ?

Hi

I am using JTextPane, JScrollPane and JscrollBar with it

and i am usinh the following

jscrollbar.setValue(jsbr.getMaximum()+jsbr.getBlockIncrement())

to showing jscrollbar at the end of JTextPane

it is working fine but after saome time when data is large in the JTextPane it is showing thisException: PRIVATE CHAT RUN ERROR java.lang.ArrayIndexOutOfBoundsException

Exception in thread "AWT-EventQueue-0"PrivateChat user Logging ...1 [http://l

ocalhost:9080/timestalk/GetMessage?id=sandix:times_jaitest]java.lang.ArrayIndexO

utOfBoundsException

at java.lang.System.arraycopy(Native Method)

at javax.swing.text.BoxView.updateLayoutArray(Unknown Source)

at javax.swing.text.BoxView.replace(Unknown Source)

[794 byte] By [pankajsinghsachana] at [2007-11-26 15:01:31]
# 1
Post a small demo code that is generally compilable, runnable and could reproduce your problem. See: http://homepage1.nifty.com/algafield/sscce.html and http://www.yoda.arachsys.com/java/newsgroups.html
hiwaa at 2007-7-8 8:50:28 > top of Java-index,Java Essentials,Java Programming...
# 2

Swing related questions should be posted in the Swing forum.

> jscrollbar.setValue(jsbr.getMaximum()+jsbr.getBlockIncrement());

If you are simply attempting to position the scrollbar at the bottom after appending text to the text pane then use the following instead:

textPane.insertString(....);

textPane.setCaretPostion( textPane.getDocument().getLength() );

camickra at 2007-7-8 8:50:28 > top of Java-index,Java Essentials,Java Programming...
# 3
Hi camickr ,It is working fine.Thanks
pankajsinghsachana at 2007-7-8 8:50:28 > top of Java-index,Java Essentials,Java Programming...