Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1914 > unrolled thread
| Started by | "Till Crueger" <till.crueger@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:36 +0000 |
| Last post | 2011-04-27 15:36 +0000 |
| Articles | 4 — 2 participants |
Back to article view | Back to comp.lang.java.gui
How to scroll automatical "Till Crueger" <till.crueger@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: How to scroll automat "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: How to scroll automat "Till Crueger" <till.crueger@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: How to scroll automat "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
| From | "Till Crueger" <till.crueger@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | How to scroll automatical |
| Message-ID | <f61l47$p3k$1@news-a.stw-bonn.de> |
To: comp.lang.java.gui Hi, I am trying to write a simple application. One part of the Application is a chat server. For this server the incomming text should be displayed on a JTextPane. Then I want to check if the TextArea was scrolled down to the bottom and if that is the case I want to have it automatically scroll down to the new bottom. So far I am only trying to always get it to scroll down. Here is what I tried: /* field is the textField, and Bar is the associated Scrollbar */ field.setText(field.getText() + "\n" + text); int max = bar.getMaximum(); bar.setValue(max); However this does not seem to work. It sometimes does no scrolling at all, sometimes it scrolls down a few lines, but not all the way to the bottom, and some rare times it even put the bar back to the beginning of the text. Can you tell me what I am doing wrong, and what I have to do to get what I want? Thanks for your help, Till -- Please add "Salt and Pepper" to the subject line to bypass my spam filter --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: How to scroll automat |
| Message-ID | <74676551a2050@uwe> |
| In reply to | #1914 |
To: comp.lang.java.gui Till Crueger wrote: >Hi, >I am trying to write a simple application. One part of the Application is >a chat server. For this server the incomming text should be displayed on a >JTextPane. Then I want to check if the TextArea Huhh? You seemed to to talking about a javax.swing.JTextPane and now are discussing a java.awt.TextArea? - If so - don't mix swing with AWT. - if not - please be specific about the classes used. For these sorts of things I would generally use a (javax.swing.)JTextArea. >Can you tell me what I am doing wrong, and what I have to do to get what I >want? For a JTextComponent to scroll to current length of the content, see setCaretPosition()/moveCaretPosition() and variants as well as getText().length(). -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200706/1 --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Till Crueger" <till.crueger@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: How to scroll automat |
| Message-ID | <f62mo3$7q7$1@news-a.stw-bonn.de> |
| In reply to | #1916 |
To: comp.lang.java.gui Am Fri, 29 Jun 2007 03:18:10 +0000 schrieb Andrew Thompson: > You seemed to to talking about a javax.swing.JTextPane > and now are discussing a java.awt.TextArea? > - If so - don't mix swing with AWT. > - if not - please be specific about the classes used. Ok, my bad. It is a (javax.swing.)JTextPane. I am only using swing, so there is no mixing of AWT and swing. > For these sorts of things I would generally use a > (javax.swing.)JTextArea. I want to be able to format the Text in later Versions, so I need a JTextComponent that supports formated text. > For a JTextComponent to scroll to current length of the content, see > setCaretPosition()/moveCaretPosition() and variants as well as > getText().length(). Ok, Thanks for your help. It is now scrolling down just fine. Now I just have to figure out the second part, not to scroll down, when the field is not at the bottom. Bye, Till -- Please add "Salt and Pepper" to the subject line to bypass my spam filter --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: How to scroll automat |
| Message-ID | <746c757dacd31@uwe> |
| In reply to | #1922 |
To: comp.lang.java.gui Till Crueger wrote: >Am Fri, 29 Jun 2007 03:18:10 +0000 schrieb Andrew Thompson: > >> You seemed to to talking about a javax.swing.JTextPane >> and now are discussing a java.awt.TextArea? >> - If so - don't mix swing with AWT. >> - if not - please be specific about the classes used. > >Ok, my bad. It is a (javax.swing.)JTextPane. I am only using swing, so >there is no mixing of AWT and swing. Good, good. >> For these sorts of things I would generally use a >> (javax.swing.)JTextArea. > >I want to be able to format the Text in later Versions, so I need a >JTextComponent that supports formated text. Right. That would require the JTextPane.. >> For a JTextComponent to scroll to current length of the content, see >> setCaretPosition()/moveCaretPosition() and variants as well as >> getText().length(). > >Ok, Thanks for your help. It is now scrolling down just fine. Now I just >have to figure out the second part, not to scroll down, when the field is >not at the bottom. Aahh.. no experience there, no time to go crashing round through the JDocs and Tutorial to find out. Good luck with that part of the problem. -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200706/1 --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web