i have searched and searched to find the answer to this problem, but alas, it eluded me and i had to turn in my project without autoscrolling (which sucks since it is a chat client)
i had to use jtextpane since it uses color but everything i have found says how to autoscroll in jtextarea
for quarter 2 i would like to add autoscolling, so if someone could please help me.
also how do you write the contents of a jtextpane to a file?
i also knew how to do this for jtextarea but lost the ability when i switched to jtextpane (i made up for it in my program by having an invisable jtextarea so i didnt lose the ability of saving log files.)
thanks!
If you mean that you would like to scroll the textpane in sideward...
Make another class that extends JTextPane.
override the getScrollableTrackViewportWidth()...
get the component's parent...
get the component's user interface. --- getUI();
since you override the getScrollableTrackViewPortWidth()...
It should return true or false only...
make an experiment about the preferredSize(component).width() in the JTextPane and the component's parent...
Return the conditions(component must be less than or equal to parent's component)....
About the text in the textpane, when you save them, you can use array of bytes...
using FileInputStream and FileOutputStream...
No hustle if implemented...
Sukatoa. ;-)