Corey, You got it right on the money, thanks! I can insert HTML at the end of the document - which allows it to scroll properly.
Have any ideas on how to make it stop scrolling if they have scrolled to the top of the document? Adam On Sat, 2003-07-26 at 09:34, Corey Edwards wrote: > On Fri, 2003-07-25 at 19:46, Adam Olsen wrote: > > What I have is a JEditorPane in a JScrollPane. The scrollbar should > > always be at the bottom of the JEditorPane text, because in an IM > > client, that's the text that came in last, which is the text you haven't > > looked at yet, right? > > > > The problem with a JEditorPane is that you cannot "append" text to it, > > only set what text is displayed. This means that the ScrollBar resets > > back to the top when you reset the text in the editorpane. > <snip> > > My question is: is there something I am missing? Some other way I > > should be going about this (in Java, for those of you who are going to > > say "go about it in another language")? > > I'll preface this with the disclaimer that I have never used the > JEditorPane specifically, but I've used other Swing components and it > looks similar. crypt(salt, advice); :) > > Normally Swing components have a clearly defined View/Model separation. > So for instance, the JComboBox has a ComboBoxModel which defines the > data contained. You create a ComboBoxModel containing a Vector or array > of your favorite data, and then make a JComboBox that shows it. It can > even update your original data by setting callbacks and such. > > I would expect a JEditorPane to be similar, and it looks like the answer > is the EditorKit. Take a look at the DefaultEditorKit and the > StyledEditorKit in javax.swing.text which inherit from EditorKit to see > how they handle it. You can pull the source out of source.zip in the > JAVA_HOME. There's also the javax.swing.text.html.HTMLEditorKit and > javax.swing.text.rtf.RTFEditorKit. > > Hope that helps some. > > Corey > > > > ____________________ > BYU Unix Users Group > http://uug.byu.edu/ > ___________________________________________________________________ > List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
