Scrolling down automatically

Hi
I noticed some strange behaviour of a JTextArea in a JScrollPane (I always use this like that, perhaps there might be better ways - I appreciate any suggestions on that, too). When I init the text area with "" the display always scrolls down to the new text when I append more.
But when I init the text area with some longer text the display won't scroll down anymore automatically - how can I fix that. I'd like it always to scroll the display down and to show the fresh text/last lines.
I wrote a demo to demonstrate the problem:
package scollbar;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.WindowConstants;
public class NewJFrame extends javax.swing.JFrame {
     private JScrollPane jScrollPane1;
     private JButton jButton1;
     private JTextArea jTextArea1;
     * Auto-generated main method to display this JFrame
     public static void main(String[] args) {
          NewJFrame inst = new NewJFrame();
          inst.setVisible(true);
     public NewJFrame() {
          super();
          initGUI();
     private void initGUI() {
          try {
               GridBagLayout thisLayout = new GridBagLayout();
               thisLayout.rowWeights = new double[] {0.1,0.0,0.1};
               thisLayout.rowHeights = new int[] {7,7,7};
               thisLayout.columnWeights = new double[] {0.1};
               thisLayout.columnWidths = new int[] {7};
               getContentPane().setLayout(thisLayout);
               setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                    jScrollPane1 = new JScrollPane();
                    getContentPane().add(jScrollPane1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(300, 100));
                         jTextArea1 = new JTextArea();
                         jScrollPane1.setViewportView(jTextArea1);
//                          leaving it like this - it always scrolls down to the new text automatically
                         jTextArea1.setText("");
//                          BUT uncommenting this the display won't scroll down anymore automatically - why?!
//                         jTextArea1.append( "Your\n mouth\n keeps\n moving...\n but\n all\n I\n hear\n is\n blah!\n blah!\n blah!\n");
                    jButton1 = new JButton();
                    getContentPane().add(jButton1, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
                    jButton1.setText("click");
                    jButton1.addActionListener( new ActionListener(){
                         public void actionPerformed( ActionEvent ae){
                              jTextArea1.append( "Your\n mouth\n keeps\n moving...\n but\n all\n I\n hear\n is\n blah!\n blah!\n blah!\n");
               pack();
               setSize(400, 300);
          } catch (Exception e) {
               e.printStackTrace();
}

When I init the text area with "" the display always scrolls down to the new text when I append more.
But when I init the text area with some longer text the display won't scroll down anymore automatically Read my reply in this posting for an explanation on what is happening:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=638441

Similar Messages

  • My BB is scrolling down automatically when I'm outside or when there's sun or daylight

    Hello, Everytime I'm trying to read my emails while I'm outside, it scrolls down automatically. Is there a way to avoid this situation?
    thnak you for your help BB 9900 7.1

    Hello ChrisCatelli and welcome to the BlackBerry Support Community Forums.
    Sorry to hear you're having an issue with your device.
    Does this random scrolling only seem to happen when you're in direct sunlight or does it happen when you're indoors? 
    If you were you try and shade the trackpad from the sun, does it still scroll on its own?
    -HMthePirate
    Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)!

  • Getting JTextArea to scroll down automatically

    I want my text area to automatically scroll down once certain text has gone below the view area, however when i update the carot to the position it still does not scroll...and i have also tried scrollPane and i just cant use them, they always mess up for me...maybe the two problems are related, so tell me if you have any ideas, thanks

    however when i update the carot to the position it still does not scroll...Works fine for me:
    textArea.setCaretPosition( textArea.getDocument().getLength() );

  • How to make a navigation for a scroll-down website?

    Hello, I created a one-page website, where you need to scroll down to see the different types of content.
    But how do I add a navigation on it?
    As example, the "About" part is somewhere in the middle of the page, how can I make a navigation which will scroll down automaticly to the "About" part when I click on it?
    I think you know what I mean.
    Greetings

    Use anchor links for the purpose - http://tv.adobe.com/watch/muse-feature-tour/muse-create-anchor-links/.
    Also check this out - http://www.musegrid.com/adobe-muse-tutorials/how-to-use-anchors-for-smooth-scrolling-singl e-page-designs-with-adobe-muse.
    Thanks,
    Vinayak

  • Is there a way to automatically have a web page begin to scroll down?

    Is there a way -- sort of an "autoplay" sort of way to have a web page begin to slowly scroll down to the bottom like a teleprompter automatically? I know this isn't technically iWeb but the site is created in iWeb and from that basis I'm sure I"ll have to edit the code somehow -- like is done when making autoplay movies and music.

    Settings > iCloud > Photos > My Photo Steam > On.

  • How to create a button which scrolls down with the page automatically?

    Hello,
    I wanted to create a button which takes u back to the top of the page when pressed on, but I was wondering how to make it scroll down with the page on the right side automatically when some1 scrolls down the page.
    An example I saw was on tumblr.com
    P.S I'm a newbie, so please explain it clearly ;d.
    Thanks.

    Create a button, position it as fixed at the top right say,
    a button{
              position:fixed;
              top:50px;
              right:50px; 
    <a href="#home"><button> Button</button></a>
    The <a> is the link to take you to the top of the page
    Just be sure to set the id home on an element at the top of the page

  • Safari Scrolling Down The Page Automatically

    Why is Safari Scrolling Down The Page Automatically? This started 3-Days ago... Also we keep getting the "MacKeep - PopUp" Everytime we Click on an Item in the Original Screen.
    We have All the Latest Update for OS X 10.9.5
    This is Clearly a Software Issue I have spoken to others who are experiencing the same.
    How do we Fix This Bug in Safari?

    You may have installed the "VSearch" trojan, perhaps under a different name. Remove it as follows.
    Malware is constantly changing to get around the defenses against it. The instructions in this comment are valid as of now, as far as I know. They won't necessarily be valid in the future. Anyone finding this comment a few days or more after it was posted should look for more recent discussions or start a new one.
    Back up all data before proceeding.
    Step 1
    From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Extensions
    Uninstall any extensions you don't know you need, including any that have the word "Spigot," "Trovi," or "Conduit" in the description. If in doubt, uninstall all extensions. Do the equivalent for the Firefox and Chrome browsers, if you use either of those.
    Reset the home page and default search engine in all the browsers, if it was changed.
    Step 2
    Triple-click anywhere in the line below on this page to select it:
    /Library/LaunchAgents/com.vsearch.agent.plist
    Right-click or control-click the line and select
              Services ▹ Reveal in Finder (or just Reveal)
    from the contextual menu.* A folder should open with an item named "com.vsearch.agent.plist" selected. Drag the selected item to the Trash. You may be prompted for your administrator login password.
    Repeat with each of these lines:
    /Library/LaunchDaemons/com.vsearch.daemon.plist
    /Library/LaunchDaemons/com.vsearch.helper.plist
    /Library/LaunchDaemons/Jack.plist
    Restart the computer and empty the Trash. Then delete the following items in the same way:
    /Library/Application Support/VSearch
    /Library/PrivilegedHelperTools/Jack
    /System/Library/Frameworks/VSearch.framework
    ~/Library/Internet Plug-Ins/ConduitNPAPIPlugin.plugin
    Some of these items may be absent, in which case you'll get a message that the file can't be found. Skip that item and go on to the next one.
    This trojan is distributed on illegal websites that traffic in pirated content. If you, or anyone else who uses the computer, visit such sites and follow prompts to install software, you can expect much worse to happen in the future.
    You may be wondering why you didn't get a warning from Gatekeeper about installing software from an unknown developer, as you should have. The reason is that this Internet criminal has a codesigning certificate issued by Apple, which causes Gatekeeper to give the installer a pass. Apple could revoke the certificate, but as of this writing, has not done so, even though it's aware of the problem. This failure of oversight has compromised both Gatekeeper and the Developer ID program. You can't rely on Gatekeeper alone to protect you from harmful software.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • Messages pane doesn't automatically scroll down

    In Outlook Express, when the list of messages is from oldest to newest, as new messages arrive, the list of messages automatically scrolls down to display those new messages.
    Out of the box, Thunderbird doesn't do that. You may be aware that there are new messages because Thunderbird has alerted you, but you don't see those messages until you manually scroll down.
    Is there any way to get Thunderbird to mimic Outlook Express?

    mailnews.default_news_sort_order; Value = 1
    mailnews.default_sort_order; Value = 1
    This means your default sort order is ascending.
    (Value = 2 means descending.)
    i'm wondering if you have something set to overrule the scroll to incoming new messages....Done some digging around and located this info....
    If you have a setting that remembers the last selected message, it may be overruling incoming new messages. This would mean that you can continue reading mail from where ever you last stopped, even if new mails arrived. So, thunderbird may scroll initially on startup if new messages have arrived, but thereafter it might not auto scroll because of the setting to remember last selection.
    So, I therefore think that if you want to remember last message you would not be using auto scroll, so the auto scroll would be false. However, you have this set to true and want auto scroll, so try to turn off the remember last message preference and note the effects.
    Please check this setting in the 'Config Editor as before.
    top search type 'remember'
    mailnews.remember_selected_message
    Value = true would switch on the remember last message and could be overriding the scroll.
    Value = false (respectively switches off the preference).
    Suggest you double click on the line to toggle to 'false'.
    close the window - top right X
    click on OK to save changes to Options.
    Close and reopen Thunderbird.
    If the effects of changing this do not suit you, change the setting back to 'true'.

  • Java based Chat console works fine, but does not automatically scroll down to last chat item

    Hi,
    I am currently facing a problem with a Chat program using jsp (Java Server Pages) where the chat console works perfect except for one little thing.
    The chat window does not automatically scroll down to the last reply in the chat window.
    the code used to scroll down to the last items (based on Netscape) is the following:
    <pre><nowiki>if (navigator.appName.indexOf("Netscape") != -1) {
    isOther = (navigator.appVersion.substring(0,1) == "3");
    isNS4 = (navigator.appVersion.substring(0,1) == "4");
    isNS6 = (navigator.appVersion.substring(0,1) == "5");
    } else if (navigator.appName.indexOf("Microsoft Internet Explorer") != -1) {
    isIE = true;
    } else if (navigator.appName.indexOf("Opera") != -1) {
    isOpera = true;
    } else {
    isOther = true;
    if (navigator.platform.indexOf("Mac") != -1)
    isMac = true;
    if (isOther)
    alert("Sorry but you will have to upgrade your browser to NS4+ or IE4+ for this to work properly.");
    function setScrollProperties() {
    if (isMac) {
    scrollStart = 0;
    scrollEnd = answerFrame.document.height - scrollStart;
    } else {
    scrollStart = 0;
    scrollEnd = answerFrame.document.height - scrollStart;
    function doScroll() {
    documentYposition += scrollAmount;
    window.scrollTo(0,documentYposition);
    if (documentYposition < scrollEnd) {
    setTimeout('doScroll()',slowScrollInterval);
    }else if (moreScrolling){
    moreScrolling = false;
    scrolling = false;
    startScroll();
    }else{
    scrolling = false;
    }</nowiki></pre>
    I cannot see what goes wrong in here and the manufacturer does not know how to fix this either.
    Irritatingly this scrolling function is working normally in IE, Chrome and some other browsers.
    I sure hope you can help me, as this is a very irritating problem that needs to be solved.
    Best regards,
    Corné Snoek

    Hi,
    sorry for such a late reply. I tried modifying the java bean to resize the JScrollPane object also but even that didn't work. Then I hardcoded the size of my Java Bean in my forms code by trial and error. For example, the size of the bean area was 381x169. The values that I had to pass to the "setSize" bean method were 510x195. This made the bean exactly fit the bean area. Seems crazy to me, but there it is.
    Anyway, thank you.
    Manu

  • Mouse or trackpad automatically scrolls down the screen

    Hello everyone. My mouse, without moving in the screen, automatically scrolls down the window I've got selected, don't know why. During this problem if I try to scroll upwards, it'll scroll down again, therefore I can't read websites, etc.
    It happens for a few secs, and then becomes normal again automatically.
    Any ideas or even better, solutions? Everything's updated, but it's really weird.
    Thanks in advance, and sorry for my poor English, not my first language.

    Don't worry about your english it's fine. English is my only language and I still have problems with it.
    I'm going to take a wild stab at this as it happened to me some time ago. Do you have a pen tablet with the pen laying on the tablet?

  • I need an arrow or some sort of icon that points and moves to alert the website user to scroll down.  Are there such widgets or is there a method to make an image move on its own.  Also, how to get my muse webpage to automatically scroll down?

    I need an arrow or some sort of icon that points and moves to alert the website user to scroll down.  Are there such widgets or is there a method to make an image move on its own.  Also, how to get my muse webpage to automatically scroll down?

    Thank you for your help, but I believe my questions remains unanswered -- mainly, because my English isn't the good. 
    Here's what I am asking:
    1.  I need something that is animated that blinks or flashes to alert the viewer to scroll down the page.  I would put the wording:  Scroll Down for more (and then an arrow blinks or gently moves up and down to alert the user to move down).
    2.  is there a way that the entire homepage on it's own moves downward?
    Sorry for my poor English. 
           From: The Arthematics <[email protected]>
    To: preston reed <[email protected]>
    Sent: Tuesday, February 24, 2015 9:42 PM
    Subject:  I need an arrow or some sort of icon that points and moves to alert the website user to scroll down.  Are there such widgets or is there a method to make an image move on its own.  Also, how to get my muse webpage to automatically scroll down?
    I need an arrow or some sort of icon that points and moves to alert the website user to scroll down.  Are there such widgets or is there a method to make an image move on its own.  Also, how to get my muse webpage to automatically scroll down?
    created by The Arthematics in Help with using Adobe Muse CC - View the full discussionIf I understood correctly. You can place arrows on each section of the page and use "fade-in" and "fade-out". And maybe you want this widget Anchor + – Adobe Muse Widget Directory to automatically scroll down. If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7227429#7227429 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7227429#7227429 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"  Start a new discussion in Help with using Adobe Muse CC by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • After applying full scroll bar to the page including header and footer, Text editor ribbon actions cause page to automatically scroll down (while applying formatting)

    After applying full scroll bar to the page including header and footer, I have provided content to
    the page more than 100 lines and try to format the text from ribbon actions(format text area). On mouse over of font or fore color, the control jumps to the highlighted content area and not able to select the color. The page scrolls down and not able to click
    on any action.
    Consider this scenario also.
    A content editor web part is added toward the bottom of the page.
    Text is added to this (direct in the web part, not via a 'content link')
    You highlight some text and go to the Markup Style dropdown...
    Everything is fine until you hover over the "Paragraph" markup style, and suddenly the page scrolls to the web part you are editing, and you didn't have a chance
    to click and apply the "Paragraph" formatting
    I have tried testing this with text typed directly into the Content Editor, text pasted in from somewhere else, and text pasted in from somewhere else using "Paste as
    Plaintext" option in the ribbon.  In each scenario, I get the same results.
    Furthermore, I have also tested this in both IE8 and IE9 and get the same results.
    I can get it to occur most regularly with trying to apply the Paragraph "Markup Style" but
    I've also seen this happen with Font Size (any font size).  It's very frustrating since you aren't able to actually apply the formatting you need because the page jumps before you can click.  Has anyone experienced this before. Any feedback would
    help.

    Hi,
    According to your post, my understanding is that after applying full scroll bar to the page including header and footer, Text editor ribbon actions cause page to automatically scroll down (while applying formatting).
    I try to apply full scroll bar to the page including header and footer, the ribbon is missing after I scroll down to the web part. And I cannot apply the "Paragraph" markup style to the content.
    I recommend to use the SharePoint core styles to preserve the native functionality and GUI.
    By design in SharePoint, the ribbon is always at the top. When you select the content, you can apply the "Paragraph" markup style in the ribbon.
    Thanks,
    Linda Li
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Linda Li
    TechNet Community Support

  • How do I disable Firefox Faster - where subsequent pages automatically load when scrolling down the page?

    When I am on the website "PlentyofFish.com" and scroll down to the end of the page, the subsequent pages begin to load up and "stack up" which conceals the previous pages and contacts. This does not normally cause a problem with other websites, like news sites, where I can read from page to page without having to find the "page forward" button.

    This should be in the same spot:
    "3-bar" menu button (or Tools menu) > Options > Advanced > General mini-tab > ''uncheck the box for'' "Warn me when websites try to redirect or reload the page"

  • When I print doc in Adobe Reader, it automatically scrolls down several inches before starting to print text.  Therefore text runs off bottom of page.  Have tried all different settings and nothing works.  Help!!!!!

    When I print in Adobe Reader, the paper scrolls down several inches before the text begins therefore running off the page.  I have tried numerous settings and cannot fix problem.  Help!!!

    I have finally cracked it!!!!!!!!!!!!!!!!
    The issue is definitely with Java Sun. "Uneven character spacing when printing JTextComponent"
    It is raised on the http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6488219
    And currently in OPEN state, and raised on 31 Oct 2006 and mentions it was caused by fix 4352983.
    So where do we go from here. It's not good because I have tried all later version of the JVM and the issue is still there.
    Why? Because it hasn't been fixed yet. Read the bug report above, as it gives more insight -- and mentions the workaround is NOT good for existing code.
    So the way forward is to use an earlier version of the JVM 5.
    I download the JVM version 1.5.0 (starting version) and works Ok... I would probably think version prior to 4352983 would be Ok too.
    Please vote for this.... We have a workaround (use older version of the JVM).
    So I am very happy.

  • I have some long spreadsheets and want to open them at the bottom instead of scrolling down through all the data. How do I do this?

    I have some long spreadsheets and want to go to the bottom to add new data without scrolling down through all the old entries. When I open a table now it goes to the top row and I have almost 300 rows to scroll through. I would like to set the table up to automatically go to the bottom row.

    Zach,
    You have a couple of options. If you use 100% View Zoom, and if you leave a cell selected in the bottom row of the table when you Save and Close the document, it will reopen with that cell in view.
    You could also sort your table in the opposite order and add new rows at the top. Then you wouldn't have to worry about what zoom you use. To insert a row at the top, select a cell in the current top row and press Option-UpArrow. That will add a new blank Top Body Row.
    Jerry

Maybe you are looking for