🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9984

Re: simulate telnet window with textPane?

#9984
From: Ernesto Bascón
Date: Mon, 06 Dec 1999 00:00
26 lines
1727 bytes
try:

      textpane.setCaretPosition(textpane.getText().length());



Trey Ethridge wrote:
> 
> Hello all,
> 
> I'm having a problem getting a jTextPane to show the last string that I've
> added to it.  What I'm doing is using a JTextPane contained within a
> JScrollPane to show some strings that I'm sending to the application.  The
> application is a simple test server for another app.  Each time the server
> app receives a string it gets the current contents of the textpane, appends
> the new string and then writes the updated text to the textPane.  Everything
> works fine until the text gets to the bottom of the viewable area and the
> scrollbars appear.  I want the window to scroll up showing the last string
> appended, but instead the scrollpane defaults to the first string at the
> top.  To see the newly appended string I have to scroll back to the bottom.
> I know there has to be a way to set the focus to the last line in the
> textpane, but I just can't figure it out.  Can anyone send me a simple
> solution?
> 
> Thanks in advance,
> Trey Ethridge
Technical Details
Message-ID: <384C146D.E2FFD86D@estudiantes.ucbcba.edu.bo>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <82f9a5$lqj6@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,dfce3bcc41cbd2f2
X-Google-Attributes: gid111d45,public
From: Ernesto Bascón <bascone@estudiantes.ucbcba.edu.bo>
Subject: Re: simulate telnet window with textPane?
Date: 1999/12/06
Message-ID: <384C146D.E2FFD86D@estudiantes.ucbcba.edu.bo>
X-Deja-AN: 557383668
Content-Transfer-Encoding: 7bit
References: <82f9a5$lqj6@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: UCB
Mime-Version: 1.0
Reply-To: bascone@estudiantes.ucbcba.edu.bo
Newsgroups: borland.public.jbuilder.java.swing