Auto-scrolling doesn't work when JFrame is not visible

Hi, I have auto-scrolling implemented for my JTextPane that sits in JScrollPane - which lives in JInternalFrame. It works as excepted - as long as my application's JFrame is visible. When the JFrame becomes invisible, auto-scrolling simply doesn't work anymore.
I've overcame this by scrolling down in "windowShown", but it's ugly because the user can visually see the scroll down when using this workaround (it jumps).
I guess this is Swing's optimization, but I would really like to overcome it in someway. But it seems I'm not enough a swing hacker to do it.
One thing to note is thtat, the auto-scrolling works fine when the JInternalFrame is NOT visible, but frame is.
I've tried to override the isShowing-method of JInternalFrame, with no luck.
Here's my scrolling method:
public static void scrollDown(JScrollPane scroll) {
          JViewport port = scroll.getViewport();
          Rectangle rect = new Rectangle(0, port.getViewSize().height, 1, 1);
          port.scrollRectToVisible(rect);
          JScrollBar bar = scroll.getVerticalScrollBar();
          bar.setValue(bar.getMaximum() - bar.getModel().getExtent());
     }Anyone have ideas?

At some point I had really hard time getting the auto-scrolling to work, as I got these weird little bumps after scrolling down.
Adding scrollBar.setValue() seemed to 'just fix it'. It actually seems to be superfluous now.
The scrolling is already wrapped in SwingUtilities.invokeLater() - in conjuction with printing text into the JTextPane and it works OK.
I had some wrong info in the first post, the viewport actually does get scrolled down even when the JFrame is not visible. And by visible I mean JFrame.setVisible(false) - my application has a minimize-to-tray feature, which hides the JFrame.
So I think the problem is 'just' a repainting problem. When the frame is shown, the previous scroll location is first displayed, and then a repaint is triggered that causes the 'jump down'.
I'm not still sure how to fix it though.

Similar Messages

  • Purchased tab in "App Store" app doesn't work when AppleID is not an email address.

    After updated my iPhone and iPad to iOS 6 (both 6.0&6.0.1), Purchased tab in "App Store" app doesn't work when AppleID is not an email address. This happened since 6.0 and I hope that it will be fixed in6.0.1 but it doesn't.
    When I tap at Purchased tab in iPad App Store or Purchased bar in Updates tab in iPhone App Store, it just hang on "Loading...", but when I changed to other AppleID, it works. Apparently, my AppleID is not an email address but the other AppleID is an email address.
    Not sure where to send my feedback to Apple about this issue.

    http://www.apple.com/contact/feedback.html

  • JPopupMenu doesn't work when invoker is not a Swing JComponent ??

    I've written some code that uses a java.awt.Canvas to draw some stuff, and I want to be able to bring up a popup menu over the canvas.
    The problem is that when I try to show the popup menu with my Canvas as the invoker nothing happens: no popup menu appears.
    I also have problems with other AWT components (e.g. with java.awt.TextArea the popup comes up with two clicks but gets hidden behinf the popup that TextArea decides to provide).
    However everything works fine when I use a Swing widget (e.g. JTextArea or JPanel) as the invoker of my popup menu.
    Is this a bug or an undocumented feature?
    The JPopupMenu.show(...) method will happily accept any AWT Component as the invoker. Also the API documentation says nothing on this issue. Also the Swing tutorials doesn't say anything about this.
    I'm tempted to conclude this is an undocumented feature, but that suprises me. Surely I'm not the first person to try and use JPopupMenu with an AWT widget as invoker? Before I file a bug report, can someone tell me if I'm missing something here?
    I have some code to demonstrate this; all you have to do is comment one line and uncomment another to repoduce this behaviour. Let me know if you would like me to post it.

    Quick followup for anyone reading this topic:
    The suggestion of using JPanel and overriding paintComponent(...) is the way to go. I had thought of doing this to begin with, but felt it would be more effort. It's not. It's the same effort as using AWT canvas, but gives better results, and doesn't stuff up JPopupMenu or anything else that wants to interact with a lightweight component.

  • Data controls not working when JFrame is not used

    Hi
    I try to use JInternalFrame for my applications and drag and drop stops to work as soon as I change JFrame to JInternalFrame and make code.
    andirus

    Andius,
    JInternalFrame support will be added to JDeveloper 10.1.3. For now, because its only a design time limitation, you could build your frame with JFrame and then turn it into a JInternalFrame.
    Frank

  • BitmapData draw method doesn't work when the project is published as the .swf file of the web applic

    Hi,
            I am totally confused by this strange error. When I tried using the draw method of BitmapData to draw a movieclip symbol of my project, it seems to work fine locally. However, as I uploaded the published .swf file to my web server and launched it as the plugin of my web application, it failed. The source codes as follows,
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    message3 didn't show at all. Instead, the browser console shows "Uncaught Error: Error calling method on NPObject.". My understanding of this error message is that the .swf is calling something crashing, and I believe that bd.draw(stage)is the crashng method call.
    Also, here is my html embed tag:
        <embed src="/tests/videoplayer.swf" id="flash" quality="high" height="510" width="990" scale="exactfit" name="squambido" align="middle" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="margin: 0px auto;clear:both;position:relative;"/>
    Can someone help me?

    Thank you for your reply.
    I tried stageWidth and stageHeight, but it still doesn't work.
    The draw() methid is triggered when I clicked a screenshot button in my application as follows,
    ExternalInterface.addCallback("printscreenClicked", printscreenClicked);
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    Would you please give me an example of "waiting for Event.RESIZE is good, or just at least Event.ENTER_FRAME"?
    My real purpose in this application is to capture a snapshot of a streaming video. The video is contained in a movieclip object. I tried stage first since BirmapData.draw() doesn't work when drawing the movieclip on the web site. Do you have any suggestion for this situation? Also, is there any good method to find out what happened if the browser have "Uncaught Error: Error calling method on NPObject."?

  • Scrolling doesn't work on some applications

    I'm using the program Notepadd++ and I can't use the touchpad to scroll. I've connected a USB mouse, and scrolling works fine with that device. I've tried reinstalling the drivers, etc, and it still has the same problem. Scrolling also doesn't work when watching flash videos on Firefox. Once again, scrolling works just fine when using a USB mouse.
    Product name: HP Pavilion g6 Notebook PC
    Product number: B5R80UA#ABA
    This question was solved.
    View Solution.

    ih23, 
    After doing a little research, it seems like it is the programs are conflicting with the driver and you are not the only one to experience this.
    Here is what I found to fix the issue in Notepad++. Note that it requires editing registry, so depending on how comfortable you are with that or not, it is up to you if you want to try this fix or not. I would always recommend backing up the registry before changing anything.
    "It seems that whatever the Synaptics driver is doing to render the scrolling cursor is confusing Notepad++.
    If you go to HKLM\Software\Synaptics\SynTPEnh and add a new DWORD named UseScrollCursor with a value of 0, the scroll cursor won't appear and vertical scrolling will work in Notepad++."
    Best of luck!
    -Kyle
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • Horizontal scrolling doesn't work with ItemsStackPanel in ListView(GridView)

    Hi,
    In Win 8.1 App Store Project I have a ListView with fixed width and listen for ContainerContentChanging event because of performance issues.
    When ListView width is less than content width, horizontal scrolling doesn't work. If we change ItemsStackPanel to VirtualizingStackPanel, horizontal scrolling works fine. But ContainerContentChanging doesn't work with VirtualizingStackPanel.
    Is it possible to make horizontal scrolling work with ItemsStackPanel?
    Here simple example to reproduce this problem:
    <Page
    x:Class="App8.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App8"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
    <DataTemplate x:Key="ContinuousViewItemTemplate">
    <Border Width="800"
    Background="Green"
    Margin="10"
    Padding="5">
    <Border x:Name="root" Height="800" Background="{Binding}"/>
    </Border>
    </DataTemplate>
    <Style x:Key="ListViewStyle1" TargetType="ListView">
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Visible"/>
    <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Enabled"/>
    <Setter Property="ItemTemplate" Value="{StaticResource ContinuousViewItemTemplate}"/>
    </Style>
    </Page.Resources>
    <Grid>
    <Grid.ColumnDefinitions>
    <ColumnDefinition Width="100"/>
    <ColumnDefinition Width="500"/>
    <ColumnDefinition/>
    <ColumnDefinition Width="500"/>
    <ColumnDefinition Width="100"/>
    </Grid.ColumnDefinitions>
    <ListView Style="{StaticResource ListViewStyle1}" Grid.Column="1">
    <SolidColorBrush Color="Red"/>
    <SolidColorBrush Color="Cyan"/>
    </ListView>
    <ListView Style="{StaticResource ListViewStyle1}" Grid.Column="3">
    <ListView.ItemsPanel>
    <ItemsPanelTemplate>
    <VirtualizingStackPanel/>
    </ItemsPanelTemplate>
    </ListView.ItemsPanel>
    <SolidColorBrush Color="Red"/>
    <SolidColorBrush Color="Cyan"/>
    </ListView>
    </Grid>
    </Page>

    Hi Mikhail Maksyuta,
    Welcome back!
    Yes, you are right! I have reproduced it on VS 2013 professional.
    I will report it as bug, Thanks for your valuable suggestions!
    If you have any other questions about this, please feel free let me know!
    Thanks again!
    Regards! 
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Horizontal scroll doesn't work.

    I have recently updated to the Firefox 5. After update my A4Tech X6 mouse horizontal scroll doesn't work in Firefox, but at the same time it works fine in other applications. I had no such problems with scrolling in Firefox 3.6.*. Please help me.

    sticksen,
    I'm glad that it is user specific. Now I only know of one file you are going to need to remove to fix this problem, but keep in mind some basic setting in other programs are going to be rest by the removal of this file, you will just have to change them back when you run across them. Example in My Mail program I had to turn of the show thread feature again.
    Ok here is what you have to due in order to delete the file. First off close all running programs including (System Preferences) but excluding (Safari). you will be perfectly fine having it running. The file is a hidden file so you need to show the hidden files on your computer to do so open (Terminal) and type in exactly as follows:
    defaults write com.apple.finder AppleShowAllFiles TRUE
    Hit return and then follow it by typing:
    killall Finder
    Hit return finder will reset and all you hidden files with show, after which Open finder and go into (Your User Name)/(Library)/(Preferences) and find the file named (.GlobalPreferenes.plist) and Delete it. Don't do anything after you delete this file just log out. Now log back in open Terminal and type exactly as follows:
    defaults write com.apple.finder AppleShowAllFiles FALSE
    killall Finder
    Now test to see if you can scroll horizontally. And just for your comfort I did this myself after disabling the Horizontal scroll and it toggles it back on. (I have a white macbook not the new unibody macbook).
    Do note that Mac keeps all settings files in (.plist)s and by removing them in your user folder will not harm your computer or the stability of your mac. These files are there just to hold settings files so that your experience can be the most pleasing for you.
    Hope that helps.

  • During video recording the auto focus doesn't work automatically!i must have a tap on the display for to use the autofocus! Ihave an iphone 4s

    during video recording the auto focus doesn't work automatically!i must have a tap on the display for to use the autofocus! Ihave an iphone 4s

    I know.  Same issue here.  When I'm not recording but have the video camera on, the autofocus works fine.  As soon as I tap the record button and recording starts, the focus is locked until I tap on the screen to focus.  I haven't used the camera all that much because of this problem.

  • Artist scroll doesn't work on iphone 6

    Just got my new iphone 6.  In itunes the scroll function on the right of the screen doesn't work when searching by artist.
    Anyone else having this issue?

    See: iOS: Wi-Fi settings grayed out or dim - Apple Support
    If that doesn't fix it make an appointment at a Genius bar to get the phone replaced under warranty.

  • IPhone sensor ( auto rotate ) Doesn't work !!

    Hello
    I bought an Iphone 4S-16G last week and I understood that on of my Iphone sensor ( auto rotate ) doesn't work it means when I landscape my iphone my messages or photos or in a games doesn't rotate , Now what should I do ?
    I already restored and turned off and turned on and checked rotation option in portrate oriention by double clicking but it didn't work .
    Please Help me .

    oops my bad, you did say exactly that you had tried that. Sorry. Also you already Restored too. Only thing I could add, is to Restore as New iPhone, at end of Restore when prompted Set Up as New iPhone. And then see if better. Anyway, iPhone 4S has full Warranty, make Genius Reservation and take iPhone to Apple for resolution.

  • My speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    my speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    Thanks for your solution, it wasn't quite what solved the problem but i remembered that i had a bit of salt water on my phone recently and spraying the charging port with an anti-oxide spray solved my problem, do you mind if i ask, how is the charging port related with the volume or/and speakers?

  • Mouse clicks, scrolling doesn't work in applications from start screen (let's call it "tile application")

    Hello!
    I need help.
    2 days ago the mouse worked fine. Yesterday I noticed that the mouse scroll does not work in the "Book Bazaar Reader". Now I found that the right mouse button and left mouse button does not work in some applications, but scrolling work in these applications.
    In mail application clicks work in some panels, scrolling doesn't work.
    In desktop mode, the mouse works perfectly.
    Please help!

    Hi
    Since at desktop mode everything fine, i suspected some application or 3rd party SW change your mouse setting
    Go to run, msconfig, run as administrator, within the System Configuration dialogue box find startup tab, find KHALMNPR (if you using logitec mouse) and uncheck it
    click ok and restart
    or try to do clean boot to eliminate 3rd party SW issue

  • I have different account ID's with my iphone and computer. I would like to standardise both to just the one. One of the ID's doesn't work, when I tried to list the second email with the preferred one a message telling me that this email is already in

    I have different account ID's with my iphone and computer.
    I would like to standardize both to just the one.
    One of the ID's doesn't work, when I tried to list this second email with the preferred one a message telling me that this email is already in use pops up.. yes it is, with me??
    Is there an easy to fix this please, Fabfitz

    If the email address you want to use is being used as the primary email address on a different ID you have to manage that ID and change it to a different primary email address.  This explains how: Change your Apple ID - Apple Support.
    If it is being used as an alternate or rescue address on a different ID, you manage the ID and either remove it or change it to a different email address.  This explains how: Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support.

  • I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing

    I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing my document using Microft Word 2010. I have tried using the tab add-in, but it doesn't respond either. The only way to convert my document is to save it as a .pdf from the save as drop down box. I need to be able to have the full functionability of creating a PDF document with the tabs and links working.
    Please help!

    From OFFICE 2010 you either have to have AA X or just print to the Adobe PDF printer. You give no information on your operating system or specifically what you mean by PDFing -- there are multiple ways to create a PDF from a WORD document and you have given no information. However, in this case your only choice is to print to the Adobe PDF printer. Otherwise, you need to upgrade Acrobat.

Maybe you are looking for

  • I have a very old IPod Touch First generation, it has the majority of my music on it under a previous Apple ID. How can i transfer music?

    I have a very old IPod Touch First generation, it has the majority of my music on it under a previous Apple ID, I recently Upgraded to an IPod 4, got myself a New Apple Mac and changed my Apple ID, Two of my old Computers are now broken and inaccessi

  • Retrieve of data from two columns into one column

    For eg: i have a data in a table with columns A & B of same size A B 1 2 2 3 1 4 2 5 3 6 5 7 1 8 4 9 10 8 Through a select i want the output of my data in one single columns, Well I can do this by using union. But my output should be like if I select

  • Mix landscape and portrait in one report

    Is it possible to have a container report have a mix of subreports that are portrait and some landscape?   Is it possible to embedd the printer portrait/landscape control characters on each subreport so it prints properly?   ...or something to print

  • Use search help to populate two screen fields

    I've done a search on this and see that plenty of people ask this question but none get answers, hopefully you'll be able to help me out. I have a selection screen with two fields: data: s_house LIKE t012k-hbkid,         s_account LIKE t012k-bankn. I

  • Really annoying RMI-related error

    Hi, I'm attempting to write a Message-Passing system so that two people can play chess against each other remotely. On each player's host computer, a ChessPlayer object keeps track of the current board layout and comes up with the player's next move.