Preventing JScrollPane from scrolling when contents change

I have an application where I have a large panel of information that is constantly being updated over time. I found a need to put more information on the panel than I could fit on my screen, so I put everything in a JScrollPane.
This works to a degree, but I find that as things in the panel get updated (JTextAreas are an example) the JScrollPane scrolls wildly about. I think it is trying to show components that have changed. I would prefer that it NEVER scroll on its own since the whole panel will be updating at any given time.
Does anyone know if there is a way to turn off this behavior? I set the preferred/minimum/maximum size on the JPanel that goes inside the JScrollPane to keep it a constant size, but that doesn't solve the problem. If someone can help me, I'd really appreciate it. Thanks!

Off the top of my head, I can think of at least two action events that are fired by a JComboBox, one has to do with selection being made and another is comboBoxEdited. If you want to do something only when an item in the combo box is selected, then you should programmatically ignore the later.
If you're doing other changes your self, you can always remove the listener from the combobox, make the changes, and then add the listener back.
;o)
V.V.

Similar Messages

  • Prevent JScrollpane from scrolling... + JTextPane

    hello,
    i've a JScrollPane(JTextPane) which displays html-code provided by the setText()-method. but i'd like the JScrollPane NOT to scroll automatically to the bottom when the programm inserts new html-code with setText(). setting the JScrollBar-Value doesn't work. I need something to prevent the JScrollBar from scrolling....
    by the way, does anyone know a way to append text to a JTextPane (line by line)... JTextPane provides only a setText()-method which overwrites the old content with the new text... i'd like to append it....
    thanks,
    andi

    This has taken me over a year to figure out. I spent lots of time trying to set the viewport back to the top or moving the scroll bar back to the top. I even tried inserting text at the very begining. None of this works. What does work is setting the cursor (caret) to the begining of the text pane after you add the text. Something like this:
    document.insertString(document.getLength(),"...lots of text...",attr);
    textPane.getCaret().setDot(0); << the big secret
    Pretty easy huh?

  • Is there a way to prevent music from autostarting when connected to bluetooth

    Is there a way to prevent music from autostarting when connected to bluetooth
    Mike

    When you connect the device open iTunes and select it from the sidebar. Click on the Summary tab in the main window. Uncheck the option to automatically connect to iTunes. You will find it in the collection of options near the lower part of the window.

  • How do I prevent Mail from opening when I click an email address in Safari?

    My wife and I both use Yahoo! Mail. Neither of us uses the Mail app to manage our email. How do I prevent Mail from opening when we click an email address in Safari?  Is it possible to direct Safari to open a separate web browser prompting us to log in to our Yahoo! Mail?

    Hmm.. probably not.
    You want to open Mail. Then go into Preferences > General and you will see something similar to this:
    In the area marked Default Mail reader click on the pull down and at the bottom of the list it will say Other. You can see if you can select Safari here and if that will open up Safari.
    Good luck.

  • How do I prevent iTunes from opening when I pug in my iPod?

    How do i prevent tunes from opening when i plug in my ipod?

    This will occur when there are photos and/or videos in the Camera Roll, which should be imported by your computer as with any other digital camera.
    Depending on the iPhoto version you are running, this can be done via iPhoto preferences > connected camera opens > select no application.

  • Lync 2013 : two problems 1) quicked off from meeting when presenter change 2) Freeze when leaving first call of day

    Hello,
    I have two problems with Microsoft Lync 2013 (see level in screenshot). The first one appeared after May Windows updates and is so annoying that I decided myself to open a post in this forum, with the second one. The first problem is the most important for
    me (see why when reading) and the second one is the cherry on the cake if solved, but is minor.
    1) I'm kicked off from meetings when presenters change
    In an online meeting, when presenters change, I'm kick off since last May updates (very clear since it didn't happen before). I'm unable to specify if it occurs when I'm presenter or just attendee, but that could influence. I will try to report if/when I
    notice a difference.
    THIS IS REALLY IMPORTANT, Please help me solve this !
    2) Lync freezes for approx. 30' to 1min. when leaving first call of day
    I reboot my PC every day. I always notice that after leaving voice call from my first meeting of the day, Lync freezes (doesn't respond message) for 30' to 1min. This is when I leave audio, not meeting window. This never occurs again in the course of the
    day. Windows goes into hourglass, then it works again.
    Does anyone know about this ? Any action to help diagnose or solve this ?
    Again this is less important than first problem
    Thanks for help
    -Pierre

    The steps to remove the update:
    Open Control Panel, click Programs, and then, under Programs and Features, clicking View installed updates.
    Click the update that you want to remove, and then click Uninstall.
    For Lync 2013 May 2014 update, it is KB2880980.
    You can check the following website about the drivers:
    http://www.driverscape.com/download/plantronics-c320-m
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make
    sure that you completely understand the risk before retrieving any suggestions from the above link.
    Lisa Zheng
    TechNet Community Support

  • How can I prevent iPhoto from launching when I insert an SD card

    I recently upgraded to a new iMac retina and am having trouble disabling iPhoto from launching when an SD card is inserted.
    I have gone to iPhoto setting and disabled iPhoto from launching when a camera is connected.
    I have also gone into image capture and selected no application as the hidden option for SD card actions when inserted.
    Unfortunately the issue persists... two questions: can I do a terminal level disable to prevent iPhoto from launching or can I remove iPhoto from my computer?

    Have you tried this?
    Open the Image Capture app
    Select your SD Card
    Click the little widget in the bottom right corner of the window
    Select the program to launch, or "No application"
    it worked for me

  • How can i prevent iphoto from opening when i plug in my iphone to the computer?

    Hi There,
    I have  a question, when I connect my iPhone to the computer the iPhoto automatically opens.
    how can i prevent this from happening? it always slows down my computer.
    any help will be appreciated.
    thanks

    Image Capture (in your Applications Folder) - In the preferences you can decide to 'Do Nothing' when a camera is connected.
    Some versions also have this option in the iPhoto Preferences.
    Regards
    TD

  • Is there a way to prevent Adobe from crashing when ocring multiple documents?

    I'm using Adobe Acrobat 9 Standard.  I am trying to OCR multiple documents, Adobe crashes when it hits a document that cannot be OCR'd. How can I prevent Adobe from crashing and to skip that document and continue the OCR'ing process with the next document in the list?

    Moving this discussion to the Enterprise Deployment for Creative Cloud, Creative Suite forum.

  • Stop JScrollPane from scrolling

    Hello, I am trying to improve a special editor i have written. Now I tried to add line numbering to it and got stuck. Here's what I did:
    I have a JScrollPane that contains a JPanel. This JPanel has a BorderLayout and contains a JTextPane (where the editable text is) in the CENTER and a JTextArea (containing the line numbers) in the WEST.
    Everytime the text is edited, I count the lines and update the JTextArea so that the right amount of line numbers is shown. But here's the problem: Everytime I update the line numbers, the JScrollPane scrolls down to the very bottom, so in some cases the caret gets hidden (which is very annoying).
    Can someone tell me how I can tell the JScrollPane (or whoever else is to blame for this) not to scroll when I update the line number JTextArea? Is there an easy way to achieve this?
    Thanks in advance

    Another way to do this:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.text.rtf.*;
    class Test extends JFrame
    public Test()
    super("Test");
    JEditorPane edit = new JEditorPane();
    edit.setEditorKit(new MyRTFEditorKit());
    edit.setEditable(true);
    JScrollPane scroll=new JScrollPane(edit);
    getContentPane().add(scroll);
    setSize(300,300);
    setVisible(true);
    public static void main(String a[])
    new Test();
    class MyRTFEditorKit extends RTFEditorKit
    public ViewFactory getViewFactory()
    return new MyRTFViewFactory();
    class MyRTFViewFactory implements ViewFactory
    public View create(Element elem)
    String kind = elem.getName();
    if (kind != null)
    if (kind.equals(AbstractDocument.ContentElementName)) {
    return new LabelView(elem);
    } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
    // return new ParagraphView(elem);
    return new MyParagraphView(elem);
    } else if (kind.equals(AbstractDocument.SectionElementName)) {
    // return new BoxView(elem, View.Y_AXIS);
    return new MySectionView(elem, View.Y_AXIS);
    } else if (kind.equals(StyleConstants.ComponentElementName)) {
    return new ComponentView(elem);
    } else if (kind.equals(StyleConstants.IconElementName)) {
    return new IconView(elem);
    // default to text display
    return new LabelView(elem);
    class MySectionView extends BoxView {
    public MySectionView(Element e, int axis)
    super(e,axis);
    public void paintChild(Graphics g,Rectangle r,int n) {
    if (n>0) {
    MyParagraphView child=(MyParagraphView)this.getView(n-1);
    int shift=child.shift+child.childCount;
    MyParagraphView current=(MyParagraphView)this.getView(n);
    current.shift=shift;
    super.paintChild(g,r,n);
    class MyParagraphView extends javax.swing.text.ParagraphView
    public int childCount;
    public int shift=0;
    public MyParagraphView(Element e)
    super(e);
    short top=0;
    short left=20;
    short bottom=0;
    short right=0;
    this.setInsets(top,left,bottom,right);
    public void paint(Graphics g, Shape a)
    childCount=this.getViewCount();
    super.paint (g,a);
    int rowCountInThisParagraph=this.getViewCount();
    System.err.println(rowCountInThisParagraph);
    public void paintChild(Graphics g,Rectangle r,int n) {
    super.paintChild(g,r,n);
    g.drawString(Integer.toString(shift+n+1),r.x-20,r.y+r.height-3);

  • Prevent Excel from recalculating when refreshing a query within a workbook

    Hello,
    I have a BEx workbook with 4 queries and a significant number of Excel formulas retrieving and rearranging query data.
    **The issue**:
    When Excel>Tool>Options>Calculation is set to "Automatic" (as it should be in normal situations), refreshing anyone query takes about 2 hours.
    When Excel>Tool>Options>Calculation is set to "Manual", refreshing anyone query takes about 2 minutes.
    Therefore I conclude that BEx does not prevent Excel from recalculating during a query refresh and this cause unacceptable delays.
    **Question**
    Is there any way to prevent to temporarily prevent Excel from recalculating during a query refresh ?
    Thank you.
    Louis

    I have a star schema, ie 5 FACT tables and 7 dimension tables, All fact tables share the same dimension tables, some FACT tables share 3 dimesnsions, while other share 5 dimensions.  
    I did adopt the best practices, and as recommended in the book, I tried to resolve them using Context, as it is the recommended option to Alias in a star schema setting.  The contexts are resolved, but I still have loops.  I also cleared the Multiple SQL Statement for each context option, but no luck.  I need to get this resoved ASAP,
    I checked all the context and they look fine, however when I again go to detect context it asks me to add the context which is already present.  It give me an option to overwrite?  Besides, I also get some Alias options.  However I was told and it was mentioned in the book that Alias is not a good option to resolve loops but context is when you have a STAR SCHEMA.
    Please suggest idea.
    AP

  • How to prevent computer from sleeping when downloading Lion from the recovery partition?

    Hello,
    I just got a new MacBook Pro that came with Lion. I'm reinstalling from the recovery partition and I'm on the downloading additional components stage. It has 3 hours to go and the computer keeps going to sleep. How can I prevent this? I don't want to have to babysit the computer for 3 more hours.
    Thanks.

    Looking for an answer to this question now.  Did you find one?  I'm about an hour into a 6+ hour reinstall of Mountain Lion from the Recovery partition on my MacBook Pro.  So I can't change the sleep corners or caffenate it or do much of anything but wait.   I want to go to bed and let it install overnight, but I assume it will go to sleep, and that will kill the download.  It there any way to prevent it from sleeping now? 
    Even trying to think of something I can put on the trackpad to trick it into thinking I'm touching it.
    Maybe ill put it under my dog, and her movements will keep it awake?  Thinking outside the box here.
    Any ideas would be appreciated.

  • Prevent iPhoto from opening when iPhone is connected?

    Does anyone know if there is a way to keep iPhoto from opening when my iPhone is connect BUT do the opposite when my digital still cam is connected? I like having iPhone auto-launch for my canon cam, but not when I connect the iPhone.

    I believe I've come across an article by someone who set up a script to run when a camera is connected, and the script detects what kind of camera and then launches or not launches iPhoto as desired. Yeah, here it goes:
    http://www.macosxhints.com/article.php?story=20080301133957211
    Seems overkill to me---I find it easy enough to manually launch iPhoto when I connect a camera, but hey, to each their own.

  • How do I stop pages from scrolling when i'm creating an interactive PDF?

    I'm attempting to create an interactive PDF portfolio with links from the homepage to gallery pages and projects etc, but it seems useless if I can't stop the PDF pages from scrolling? Can anyone help?
    I have InDesign CS5.5 and Adobe Acrobat Pro.
    Thanks,
    Elizabeth

    I had the same problem with an interactive PDF I created out of InDesign CS5.5. Not sure if what I found will work for a PDF portfolio but here is what I did.
    After creating my document and exporting it as an interactive PDF I opened it in Acrobat X. I went to file/properties and opened the dialogue box. I then clicked on the "initial view" tab and checked the "hide toolbars" and "hide window controls" clicked okay, closed the dialogue box and re-saved the PDF.
    The next time I launched it you could not mouse click to navigate the pages anymore, you had to use the interface I had created. The only caveat is that the keyboard arrows and the mouse scroll wheel still work but if you click anywhere on the page other than my buttons the pages now stay put.
    Hope this works for you,
    Phil

  • How to prevent iTunes from launching when iPad is connected?

    I don't want iTunes 11.0.1 to launch every time I connect my iPad (3rd generation, running iOS 6.0.1) to my Mini. I want to decide if I want iTunes, and then, if I do, launch it manually. How may this be accomplished?
    Notes:
    1.  iTunes .. Preferences .. Devices ==> "Prevent ... from syncing automatically" is UNchecked.
    2.  (in iTunes while connected) iPad .. Summary .. Options ==> "Open iTunes when this iPad is connected" is UNchecked.
    3.  When iTunes auto-launches, it does NOT sync. It "mounts" the iPad and then sits idle.
    TIA for any ideas,
    Mark

    Found the answer via Bing:
    http://www.brighthub.com/computing/hardware/articles/72004.aspx
    With the iPad connected and (at least in my case) iTunes NOT running, start the program "Image Capture" (mine is version 6.1). In the lower left will be a label "Connecting this iPad opens:" and below that label is a drop-down box which, in my case, was set to iTunes (don't ask me how), and I have since changed to "No application".
    Gee, that was obvious.
    </sarcasm>
    Mark

Maybe you are looking for

  • A problem about IDOC Receiver

    Hi, everybody. This time, I'm developing a IDOC Receiver though the SAPIDocReceiver class. With the dotnet Connector manual from SAP, the receiver side on dotnet is easy to develop. But how to configure the SAP R/3 to send IDOC to the dotnet side, I

  • Submitting pdf form using Adobe Reader

    Using Acrobat 9 Pro I created a form to capture personal info from donors to our non-profit. When displayed in Acrobat 9 the SUBMIT button works as intended (brings up a message to send using my Email client with the pdf attached and addressed to the

  • Expressions in 1-M relationships

    Let's say I have a USERS table with a 1-M relationship with a PARAMETERS table. PARAMETERS hold things like custom-defined fields for a USER. USERS has 2 fields of interest: ID NAME PARAMETERS has 3 fields of interest: USERID PARAMETERNAME VALUE The

  • RDS 2008 R2 Internet explorer auto log out after 20 seconds IE9

    I have Windows RDS (remote Desktop services) 2008 r2 running (2 Gateway servers, 1 Session host, and 1 licence\broker server) and it has been working fine for past several months. Currently whenever a user launches an app that is internet biased or  

  • How can i update my itouch without deleting my media?

    how can i update my ipod touch on my laptop without deleting my media? everytime i try to update it, it tells me it will dete my media and i dont want it to. is there a way i can update it without deleting any media?