Setting a JScrollBar to maximum

Hi,
I have a JTextArea that is used for chat messages in an applet.
When new text is added to the JTextArea, and I want the JScrollBar to scroll to the bottom.
First I called
textArea.append(string);
scrollBar.setValue(scrollBar.getMaximum());
Sometimes this worked, sometimes the scrollbar would jump to the top. So I tried using a DocumentListener, which would wait for an insertUpdate. But this causes my browser, and the java machine, to crash.
I'm using the java plug-in 1.3.1_02, ie6 and winXP.
How do I make the scrollbar scroll to the bottom after new text is added to the JTextArea?
thanks,
sacka

easy!
if you use JViewport then you can use
JViewport.setViewPosition(Point p)
but I belive you must use JScrollPane which use JScrollPane as jTextArea's container,so can use
JTextArea.scrollRectToVisible(Rectangle aRect)
to force scrollbar to roll the rectangle ,
importantly, the rectangle must be correct ,if JTextArea's area is big then JScrollPane ,then you can set Rectangle to the last view Which you want to see

Similar Messages

  • Setting the Minimum and Maximum Y Axis Points

    Hi,
    I have an Application where I need to plot the charts using Time-Scatter Graph .
    I am using 2 Y-Axis.
    But I am unable to dynamically set the Minimum and Maximum y-axis points through code.
    Currently I have set the Minimum and Maximum points for the Y Axis in BG (Business Graphics) Design Time.
    Please suggest if we can set the Min & Max values through code as it is very cumbersome to manually set the Min and Max Values for say around 400 odd charts.
    We are unable to set the Chart Title too dynamically.
    Thanking in advance,
    Poojith

    Any Experts here.. Please help

  • Why does my iPhone arbitrarily brighten, to the point of decreased resolution, despite my having turned off auto-brightness and setting the brightness to maximum?

    Why does my iPhone arbitrarily brighten, to the point of decreased resolution, despite my having turned off auto-brightness and setting the brightness to maximum?

    Could be a hardware failure.
    Restore the iPhone, first from a backup, then as new, and see if the issue persists. If it persists when you restore as new, then there's a hardware issue with your phone and you need to bring it to an Apple store to be evaluated.
    ~Lyssa

  • How Do You Set a JFrame's Maximum Size?

    Can someone show me a quick example? The JFrame can be empty, I just want to know how to set it's maximum size. I tried using setMaximumSize() and it doesn't work for some reason but setMinimumSize() works fine.
    I tried it using a BoxLayout and even using null as a layout manager and can't get it to work. I heard that the other layout managers don't allow you to set the maximum size of a JFrame so that is why I tried it with the layouts that I did.

    Darryl.Burke wrote:
    Are you displaying your MyFrame as a top-level window or adding it to a parent JFrame with null or BoxLayout set?
    Maybe the method you're looking for is setMaximizedBounds(Rectangle bounds)
    You could also try this: setBackground(...) to something other than the default background and run your program again.
    I'm at work and can't try ou any of my suggestions, so please post back if you get any progress.
    dbsetMaximizedBounds is a little better but not really what I was looking for. I can still make the window go passed the set boundaries when the window hasn't been maximized.
    Also, I checked that method setBackground, that only seems to change the color, is that the same method you were referring to?

  • BIOS SETTING, need help! MAXIMUM PAYLOAD SIZE? NEO4 PLAT SLI

    Hi everyone, this is my first post here, and hope someone will help me out.  I've searched the internet, posted on other websites and no one can help me with this question.  What does MAXIMUM PAYLOAD SIZE do?  What is the correct setting for this?  Curruntly I have it at 4096, but what should it be at?  Thanks everyone.

    Thats a good one (question)... as far as I know it could be similar to the old AGP Aperture Size, but the amount of data doesn't correspond; megabytes vs. kilobytes.
    It could be the logical data unit which is carried thru the PCI-E bus in order to feed the PCI-E devices, this is sounds better yet again would be something similar to the AGP Aperture Size: not amount of data being mapped at physical memory, but the size of the data units being transfered.
    Hope this helps... try the values to either side and test with a 3d Benchmark, if you see a diference then come back and tell us.
    Good Luck.

  • Cash Journal : How to set the limit for maximum payment of 20000

    Hi Gurus,
    Please tell me how can i set the maximum payment limit of 20000 in cash journal?
    Please revert asap.
    Thank You

    Hi
    Amount Limit
    Use
    You use these functions to define limit values for the FI cash journal; where these limits are reached and exceeded, the user is prompted (in an information dialog box) to run certain activities. The check is always performed in the first local currency of the company code.
    In the countries of the European Union, these functions are used to draw attention to the legal requirement for identifying the payer (money laundering law § 3 para. 1).
    Activities
    Company code:
    You do not have to enter a company code. The entry is then valid for all company codes within a client that use the currency specified as the first local currency.
    Currency:
    Each amount must be specified by the classification of the currency. If you specify a company code, the currency of the company code is entered in the currency field and you cannot change this.
    Date and amount:
    The amount limits are defined time-dependent ("Valid From").
    In addition to the above
    Input your company code,Currency,Valid from and the amount limit
    Good Luck
    Hari

  • I am having trouble setting a JScrollBar in a a scrollpane to the top

    I get the scrollbar, and set it to the up position, and immediately afterwards it sets itself back to the bottom.
    The item contained in the scrollpane is a JPanel, and I has lots of stuff in it.
    If I do not set it myself, it stays at the bottom...I see it jumping up, but it immediately goes back down.
    I set some info that changes the GUI in the contained panel ncluding an image and some text.
    This is where the actual item is changed, called by a listener in a JTree.
    SetViewObject changes the text and the image of the panel in the scrollpane.
    public void doTreeSelectionChanged()
    DefaultMutableTreeNode defaultMutableTreeNode
    = (DefaultMutableTreeNode)
    getLastSelectedPathComponent();
    if(!(defaultMutableTreeNode instanceof HMIViewTreeNode))
    detailWindow_.setViewObject(null);
    summaryWindow_.setViewObject(null);
    JScrollPane parent = (JScrollPane)
    (summaryWindow_.getParent().getParent());
    JScrollBar scrollBar = parent.getVerticalScrollBar();
    scrollBar.setValue(0);
    return;
    HMIViewTreeNode viewTreeNode =
    (HMIViewTreeNode)defaultMutableTreeNode;
    if(viewTreeNode!=null)
    detailWindow_.setViewObject(viewTreeNode.getViewObject());
    summaryWindow_.setViewObject(viewTreeNode.getViewObject());
    }else
    summaryWindow_.setViewObject(null);
    detailWindow_.setViewObject(null);
    revalidate();
    JScrollPane parent = (JScrollPane)
    (summaryWindow_.getParent().getParent());
    JScrollBar scrollBar = parent.getVerticalScrollBar();
    System.out.println("Setting visible amaount to "
    +scrollBar.getMaximum());
    scrollBar.revalidate();
    scrollBar.setVisibleAmount(scrollBar.getMaximum());
    scrollBar.setValue(0);
    I cannot see what the problem could be...I have also tried doing setVisibleAmount to the size of the scrollbar to no avail.
    Please let me know if you have any idea!

    Well, I put a bandaid on the idiocy by setting the viewport to not perform scroll rect to visible...I do not need to use that, so I suppose this is acceptable at least for my app.

  • How to set an applet's maximum size?

    Hi there
    If Applet inherits Panel, and Panel is a Container and a Container is a Component, why using the method "setMaximumSize(Dimension d)" (of class Component) in an applet (or JApplet) always gives a compiling error saying it does not recognize this method?
    I apperciate your help

    I found a solution
    <applet id="applet_name"
    code="path_to_applet_class/class_name"
    style="width: 1px; height: 1px; float: left;"
    mayscript></applet>
    see ... http://windyroad.org/2006/08/14/reintroducing-javascript-and-hidden-applets-jaha/

  • HT5639 Why the brightness in window 8 in my macbook pro is so dim? (ps: I've already set the brightness to maximum)

    How to solve this problem?

    How full is the hard drive?
    To get more information about your computer, go to the Apple in the upper left corner of any window, then "About This Mac", then "More Info..."  Copy and paste the information here, but omit the serial number and Hardware UUID (if present).

  • How to set minimum and maximum X scale in the XY graph if i have a X scale time format ?

    Hi,
    i choose in the picture enclosed, a time format for the X scale of the XY Graph.
    The problem is that i am not able to set the minimum and maximum of the X scale: In fact the property nodes of the minimum and maxinum X scales ask for  double as input.
    But i need to set my minimum and maximum X scale to be a time (because I already set the X scale format to a time)
    Could u help me please ?
    Samer,
    Attachments:
    scale.JPG ‏8 KB

    please i have another problem:
    i put the XY Graph in a while loop with maximum and minimum Xscale as property nodes inputs.
    The problem is that when i make a zoom  i can just see the zoom for a little while and then (because of the while loop) the Xscale is updated.
    is there a method so that the Xscale be updated just when i change its value ?
    or Could u tell me how could i zoom properly ?
    Samer,
    Attachments:
    zoom.JPG ‏11 KB

  • Setting CALCCACHELOW to maximum

    Understand that Essbase will keep a calculator cache to keep calculation blocks. What if the CALCCACHELOW is set to max i.e. 200MB, will it enforce Essbase to maximize the usage of cache for calculation?

    NN wrote:
    Hi,
    Why would you want to set it to maximum? You can set CALCCACHEHIGH to maximum instead
    and you use SET CACHE HIGH; in your calc script. Using Maximum does not necessary improve performance.
    Use multiple bitmap scenario to calculate calc cache required for your database. There are cases in which
    the member of sparse dimensions is too large, even setting calc cache to maximum
    has no use as calculator cache will not be in use.
    If you have many apps, and each of them use Maximum calc cache, it may simply overuse the memory resource.
    Regards,
    LianThanks for your advice. So it is better to set CALCCACHEHIGH to maximum i.e. 200MB, and then let Essbase to determine by itself what is the value being used?

  • Set peer maximum no 40 exceeded

    Dear sir ,
    on CISCO 2851 router i am unable to create new set peer connection below message shown on router
    "Set peer connection exceeded maximum 40 "

    Hi,
    Did you change the settings in OAY2 to 0 indicator after the creation  
    of the asset in question ?                                                                               
    Could you check the following fields :                                 
         ANLB-XGWGK  for the asset                                         
         ANKB-XGWGK  for the asset class                                                                               
    Regards Bernhard

  • I'm a bit hard of hearing, and I can't get Firefox to boost the volume adequately, even though I have set all volume controls to maximum. Please fix.

    I can't get the volume loud enough, despite setting all controls for maximum volume.
    I'm using Windows XP, and a high-end computer/monitor/speaker. I'm using Firefox 4.0.1
    I figure you guys are all young, and your hearing is still good, so you don't understand us older folks.

    Got the same problem.  It seems it is happening all over the place with the i-tunes update.

  • "Maximum Render Quality" Better to turn it OFF when using CUDA MPE?

    http://crookedpathfilms.com/blog/201...port-settings/
    "IMPORTANT NOTE ABOUT RENDERING TIME:  Make sure you do not select “Use  Maximum Render Quality” if you are utilizing the accelerated GPU  graphics (Mercury Playback Engine).  This will not improve your video  and will only slow down the rendering speed by as much as 4 times!"
    http://blogs.adobe.com/premiereprotr...e-pro-cs5.html
    "For export, scaling with CUDA is always at maximum quality, regardless  of quality settings. (This only applies to scaling done on the GPU.)  Maximum Render Quality can still make a difference with CUDA-accelerated  exports for any parts of the render that are processed on the CPU...
    When rendering is done on the CPU with Maximum Render Quality enabled,  processing is done in a linear color space (i.e., gamma = 1.0) at 32  bits per channel (bpc), which results in more realistic results, finer  gradations in color, and better results for midtones. CUDA-accelerated  processing is always performed in a 32-bpc linear color space. To have  results match between CPU rendering and GPU rendering, enable Maximum  Render Quality."
    Here is what I got out of after reading those two sites:
    I should turn it off for it's always ON (when CUDA MPE is used)  regardless I check or uncheck it.Turning it ON only offloads the  calculation to CPU (instead of GPU) hence slowing down the previewing  and encoding performance.
    So I guess I should have Maximum Render Quality setting turned OFF in both of squence settings and export settings.
    However, David Knarr of Studio 1 Productions suggest otherwise:
    http://www.studio1productions.com/Articles/PremiereCS5.htm
    "When you startup Adobe Premiere CS5 and you don't have a certified video card  (or one that is unlocked) the Mercury Playback Engine is in software rendering mode  and by default the Maximum Render Quality mode (or MRQ) is to OFF.
    (Maximum Render Quality mode will maximize the quality of motion in rendered clips and  sequences.  So when you select this option, the video will often  render moving objects more sharply.  Maximum Render Quality also maintains sharp  detail when scaling from large formats to smaller formats, or from  high-definition to standard-definition formats.  For the highest quality exports you should always use the Maximum Render Quality  mode.)
    When you unlock Adobe Premiere CS5 so the Mercury Playback Engine can use almost  any newer NVidia card (or if you are using a "certified" NVidia graphics card),  the Mercury Playback Engine will be in the hardware  rendering mode and the Maximum Render Quality mode  will be turned ON.
    Since the software mode is not set to maximum render quality,  it can sometime render faster than the hardware render, but a a loss in  qualitly. If you set the software to  maximum render quality you will see that it is very, very slow compared to the  hardware render.
    Here is how to set the Maximum Render Quality.
    1)  Open up Premiere CS5
    2)  Click on Sequence at the top of the screen
    3)  Then select Sequence Settings
    4)  At the bottom of the window select Maximum Render Quality and click Okay
    It is always best to be using the Maximum Render Quality mode,"
    Now, I'm lost.

    Okay, I am loosing it.....    You are correct.
    I am not sure what I was remembering, I could have sworn that when I loaded Premiere CS5 for the first time before I unlocked the video card, the Maximum Render Quality mode was NOT checked.  Then when I unlocked the video card,  the Maximum Render Quality mode was check to ON and I didn't set it to be On.
    I just when back and uninstalled Premiere and re-installed it, to see what was going on and I was totally wrong.
    Sorry for the mistake and I will be updating the article on my website in the next 15 min.
    Also, I have written a small program to do the unlock automatically.  The program is free and it works with the cards listed under the Automatic Mode.
    If your video card isn't listen, just let me know what your card is and what you typed into the cuda cards file and I will add it to the program.
    David Knarr
    Studio 1 Productions

  • How do I set cursor.index to anywhere in the graph array?

    I am using LV 8.5.1 and feeding an XY graph with an X-Y array of data. Only a section of the array is displayed on the graph. I have a cursor (single-plot).
    I would like to set Cursor.Index property node of the cursor associated with the plot to the maximum index value of the graphed array regardless of the XScale range. I don't seem to be able to do it. I cannot set it beyond a certain number. When I rescale the graph I have a new maximum number. Is this what should happen?
    To get around this, I am momentarily setting the XScale.ScaleFit property to 1, which then allows me to set Cursor.Index to maximum (I then immediately reduce my scale range appropriately). I am having to do this before every occurrence of setting the Cursor.Index in case the new setting exceeds the currently allowed maximum value. Just seems a bit clunky.
    Thanks for any help.

    This is no longer a problem. My data is too big to feasibly be fed into a graph so am having to chop it up and use my own index pointer.

Maybe you are looking for

  • Trackpad no longer drags after Security Update 2015-003

    I am running Yosemite 10.10.2 on my MacPro 2010. After I installed Security Update 2015-003, I noticed my Apple Trackpad can no longer drag. Here are the symptoms: I CAN move the cursor around the screen using the trackpad. I CAN click, and appropria

  • To re install Prem Prod 5 on Mac OSX 10.9.5 do I have to uninstall?

    To re install Prem Prod 5 on Mac OSX 10.9.5 do I have to uninstall & deactivate the whole suite to Re install it?

  • Creating dynamic textbox in JSP

    I am trying to create dynamic textbox.when i run this below JS ,I am getting two boxes only and then i nothing getting it displayed.The problem comes in the inner for loop. function DynamicBox(val)                     alert("helloooo");              

  • GRC AC DATA MART CONFIGURATION

    Hi All, We are on GRC AC 5.3 SP 11. The customer wants to use the Data Mart functionality with crystal report 2008 for custom reporting purpose. In my knowledge this functionality is available in AC since SP 9. But don't know the exact procedure to g

  • Restrict authorizations for loads from HR to BW for certain data

    Hi, our customer wants protect some data in the HR productive system. This data are defined/restricted by certain personal areas. It is not enough to use reporting authorizations in BW to restrict presentation in queries or use filters in infopackets