Capturing the apperance of a component before it gets visible and laid out

Basically, I'm trying to make components fade in. My strategy is to create a BufferedImage instance, and have the component paint on this image (aComponent.paint(img.getGraphics()). When I have the BufferImage, I can easily use Java2D to make the image fade in, by blending it with the background. When the image is fully shown, I simply show the real component instead of the faux image.
This all works fine, if the component has already been shown, and I want to capture an image of the component and fade it out. The problem is, when the component has never been shown (and been laid out by the layout manager), all I get is a gray image. I have been trying various things, like calling aComponent.doLayout(), and then I usually do get a few of the sub-components painted (that in turn make up the component I'm referring to), but not all of them, and the layout seems wrong. For example, a left-aligned text field (again, part of the component I'm trying to fade in) might appear as it should, whereas a layout-sensitive component such as a JEditorPane will not have gotten its proper size, and other sub-components still will not even be present.
Are there are Swing gurus present that can help me sort this out?

Thanks for all your suggestions. Actually, I'm not only trying to fade the component in, I'm also rolling it up and down. The code I'm working with is based on Fr�d�ric Lavigne Apache-licensed JTaskPane (http://common.l2fprod.com/), which supports expanding and contracting an image of a component.
Basically, the way JTaskPane works (and more specifically, the JCollapsiblePane it uses), is that an image is taken of the component when JTaskPane is initialized. This all works fine when the JTaskPane is initially expanded (that is, the real component is shown), but my application requires that initially, the component is not shown. I have attempted to patch Fr�d�ric Lavigne's code so that the image is taken right before it is to be shown, but I still only get a gray image.
I have had limited success using SwingUtilities.invokeLater() -- but my component is not fully laid out even when I capture the image in the run() method of the object instance I pass to invokeLater() (specifically, the JEditorPane that is placed on my component, is not yet laid out, but the JTextFields are). Curiously enough, if I use a javax.swing.Timer, I manage to capture the fully laid out image just fine, but I would prefer using a more elegant solution.
All suggestions are most appreciated.

Similar Messages

  • Need help about how to capture the name of an object before inserting.

    Hi everybody,
    how i can capture the name of an object before it inserts in a table.
    i will use a pre-insert trigger to do this, but i don't know how to specify the name of the object that's inserting.
    any help about this issue will be appreciated.

    Mentioning objects you mean: You have a procedure which inserts data into some table and this procedure needs to know the name of the caller (another procedure or ...)
    Can this be of some help http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:382218730166 ?
    Regards
    Etbin

  • HT4098 I have a subscription to The Telegraph which I purchased before changing my email and apple ID.  How can I get iTunes to transfer this purchase and put it under my new apple ID?

    have a subscription to The Telegraph which I purchased before changing my email and apple ID.  How can I get iTunes to change it to current ID

    Did you create a NEW Apple ID or did you change the email address for your OLD Apple ID? This will affect how you update apps in the future.
    Anyway, go to Settings/iTunes&App Stores, log out, then log in with the new ID.

  • I accidently "x" off the download of firefox 4 before it had finished and now the home page doesn't work, i tried redownloading firefox but that didn't work is there a way i can resume the download?

    I accidently "x" off the download of firefox 4 before it had finished and now the home page doesn't work. it loads but then wont let me search from it? i tried redownloading firefox but that didn't work is there a way i can resume the previous download?

    Your More system details list show that you run the latest Firefox 4.0.1 version.<br />
    You can check that via Help > About Firefox and on the Help > Troubleshooting Information page.
    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process.
    See:
    * https://support.mozilla.com/kb/Server+not+found
    * https://support.mozilla.com/kb/Firewalls
    If you posted from another computer then download the full version and uninstall the currently installed version.
    Download a fresh Firefox copy and save the file to the desktop.
    * Firefox 4.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Uninstall your current Firefox version.
    * Do not remove personal data when you uninstall the current version.
    Remove the Firefox program folder before installing that newly downloaded copy of the Firefox installer.
    * It is important to delete the Firefox program folder to remove all the files and make sure that there are no problems with files that were leftover after uninstalling.
    Your bookmarks and other profile data are stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder] and won't be affected by a reinstall, but make sure that you do not select to remove personal data if you uninstall Firefox.

  • We just got 2 iPad air today and Set up both with the same Apple ID, now I'm getting messages and FaceTime for my 13 yr old daughter.  Do I have to create a different Apple ID for her?

    We just got 2 iPad air today and Set up both with the same Apple ID, now I'm getting FaceTime and messages for my 12 yr. old.  Do I have to set up a separate Apple ID  for her to avoid this?

    It's a trust issue. You can set them up so you don't receive each other's messages as long as you each have your own email address.
    The trust issue is the fact that either of you can change the separation at any time via Settings by checking the appropriate (inappropriate?) email address.
    To be absolutely sure you can never receive each other's messages will require two Apple IDs.

  • How do I get a PDF document put into an attachment form that I can drag to an e-mail.  Usually I get an icon showing an spiral note book which then becomes an attachment when I drag it to the e-mail, but occasionally it stays in PDF and prints out on the

    How do I get a PDF document put into an attachment form that I can drag to an e-mail.  Usually I get an icon showing an spiral note book which then becomes an attachment when I drag it to the e-mail, but occasionally it stays in PDF and prints out on the e-mail.  What have I done differently?

    Thanks again for the detailed instructions Srini!
    And I really hate to be a pest . . . but . . .
    Using your example and not modifying it, I get the e-mail form filled out correctly and the pdf attached, however, I'm not prompted to sign it.
    Any more clues?

  • HT4914 I have several songs in my ITunes library that show as ineligible to be uploaded to ICloud, even though most of them were purchased through the ITunes Store. Has anyone else experienced this and figured out why?

    I have several songs in my ITunes library that show as ineligible to be uploaded to ICloud via Match, even though most of them were purchased through the ITunes Store. Has anyone else experienced this and figured out why?

    I had the exact same issue!! Seriously p*ssed me off when I checked out my ITunes purchased items (via my computer) and noticed that most of the additional tracks listed on my IPhone playlist was listed there too. However, I never authorized any purchases!!  (I have actually written Apple Support asking for a full refund of all tracks listed on my purchased list)
    Be careful when you swipe your finger to the left/right on those "additional" tracks on your IPhone playlist... I'm pretty sure that the cloud symbol is an option to download or automatically buy those tracks.
    Solution for the problem:
    1 - go to your IPhone settings
    2 - choose "iTunes & App Store"
    3 - go to "Show All" & "Music"
    4 - turn off "Music" by moving the bar to the left (it should be a white color once you turn it off)
    Should solve your problem :~)

  • I Got iPhone 5 BLACK 25 Dayz ago and now the color of its side body is getting fade and started turning into silver PATCHES. help me out

    i m From India.
    i Got iPhone 5 BLACK 25 Dayz ago and now i saw That Suddenly the color of its side body is getting fade and started Leaving SILVER PATCHES.
    i'm Scared Of It
    please help me out

    Put it in a case or stop being so rough on the device.

  • I have a macbook 2011 and its booting to the apple with a loading bar. it gets halfway and changes to a screen with the apple and a spinning circle. It spins untill it dies. will not boot to safe mode. Do not have orriginal osx disk either.... HELP :(

    i have a macbook 2011 and its booting to the apple with a loading bar. it gets halfway and changes to a screen with the apple and a spinning circle. It spins untill it dies. will not boot to safe mode. Do not have orriginal osx disk either.... HELP

    It happened after an update

  • TS5376 I have been trying to install Itunes for the past 1.5 days without success.  The method outlined here did not work and gave me the same error messages as before  Runtime error R6034 and  also error 7

    I tried the latest Apple fix to resolve the installation issues of iTunes 11.1.4 and had no success at all.  This was the fix that asked you to remove .dll files and place them on the desktop before unistalling and reinstalling iTunes.  I followed the procedure exactly and obtained the same results as before.
    Namely,
    Runtime Error: R6034 -An application has made an attempt to load the C runtime library incorrectly
    iTunes was not installed correctly.  Error 7.
    At this point, after spending 1.5 days attempting to install iTunes I am giving up.  Hopefully, someone will come up with a fix that really works and I will install it then.

    Hi
    I had the same problem on my PC's with Win 7 and Win XP.
    I solved it this way:
    - De-install iTunes, best with a special tool, like, for example "Your Uninstaller" from Ursoft. Any other un-installer will do the job, provided it cleans the registry of traces from iTunes
    - De-install "Apple Mobile Device Support". This seems to be the culprit. It is a sub-program of iTunes. But if you just de-install iTunes this sub-program stays in your PC. If you still have it on your PC and you try to update to 11.1.4, it will cause these problems.
    - De-install also "Apple Application Support", but I am not sure it is really necessary, but de-installing does no harm, since it will be re-installed automatically.
    - De-install also "Apple Software Support", but I am not sure it is really necessary, but de-installing does no harm, since it will be re-installed automatically.
    - Re-start your PC
    - Download the latest version of iTunes from the Apple webpage and install it.
    For me this worked on both of my PC's.
    Regards
    goletto

  • My Mac Pro starts up when I turn on the power, BEFORE I switch it on with the button, why? Plus, my computer keeps freezing and blacking out.

    My Mac Pro starts up when I turn on the power supply (when I plug it to the outlet), BEFORE I switch on the button on the computer, why is this happening? Plus, my computer keeps freezing and blacking out and I'm forced to restart it, that's when the compter starts on its own when I turn on the power.

    Hello Engender,
    I should have followed up with a progress report because I eventually eliminated all the problems I was having with my Mac Pro, now it's behaving like a new computer… beautifully.   I did originally take Grant's advice above, changing the setting that I had in the System Preferences > Energy Saver but that only stopped from rebooting on its own when I shut down my Mac properly.  Otherwise it continued to restart on its own after freezing or crushing when I switched on the power.  I took my machine to the Apple Store and after many tests they couldn't find anything wrong with it.  I was very depressed about the whole business.
    It was after going onto many of the other Apple related websites that I discovered that it wasn't a faulty power switch or fan, as as I originally thought, but found out that my problem was related to the Graphic Card and possibly I did not have enough ram (I had the original amount of 2 GB).  The original card that came with the computer: 512 MB ATI Radeon X1900 XT was over heating and forcing my machine to shut down, I think it was because I had upgraded to OSX Lion which on its own requires at least 2 GB of ram to operate well.  I added 4 GB of Ram to the 2GB I had (4GB kit (2GBx2), Apple 240-pin FBDIMM, DDR2 PC2-5300 upgrades for Apple Mac Pro (4-core) 1st Gen. - 2006-2007 Desktop/PC, CT579443 from Crucial.com about $160 for the set) and replaced the Graphic Card with ATI Radeon HD 5770 1024 MB from Apple (around $260), (ATI Radeon HD 5770 Graphics Upgrade Kit for Mac Pro (Mid 2010) - Apple Store (U.S.))  This card works very well with my original Mac Pro 2008.  I installed it about two weeks ago and no problem with it starting on its own, over heating or freezing.  OSX Lion works well and I'm thinking of upgrading to Mountain Lion once I learn that my Mac Pro 1.1  will work with the new hardware I installed.
    Your problem could just be the power cord but I agree with you that doesn't sound right, when I mentioned faulty switch I meant the part where the power cord meets the power button, the unit which houses the power distribution, I thought at first that it could be faulty but changed my mind because of the computer overheating. 
    I don't know if this is of any help to you but I hope your trouble will be solved with the new cord.

  • When I download a movie from iTunes the cover art disappears. I try get info and add the art, it doesn't show up. So it's just gray. It opens and plays fine. Apple can't figure it out. It's an nas drive. When I use a firewire drive I get the art

    When I download movies from iTunes to my NAS drive, I don't get the cover art. It shows up while its downloading, but when it's finish it disappears. If it has an iTunes extra the cover art is there. I tried get info and add the cover art, it never shows. Regardless of how I add it. Funny thing is, if I download the same movie to my external firewire drive, no problem its there. I've called Apple with no success. I've even tried copying the movie with the art from the firewire drive to replace the file on then NAS drive I still loose the movie cover art. I also tried several times to re download it, no luck. Any ideas? I'm out of ideas.

    Do you have any videos/movies in the video app?
    In iTunes if you right click on the video and select Get Info and go to the Option tap what Media Type is shown?

  • ITunes wont download the restoring software for my itouch it gets finished and gives me an error message that says the network conection timed out but it works fine what do i do?

    i tunes wont download itouch restoring sotware it gets finished and gives me an error message saying the network conection timed out but its working fine what do i do?

    I have this same problem, i though it was my internet (super slow) it would take 3 HOURS!! to download the update and then after all the waiting, it would say "network connection timed out" Ive restarted it and checked my settings over and over but it still says "timed out" wat should I do?!?

  • Capture Direct to External HD/Dropped frames with Firewire-In and eSATA-Out

    I have been working on a setup with a brand new 2.6 GHz MBP/4 GB/200 GB-7200rpm HD. I am capturing DVCAM via Firewire400. I am capturing direct to a LaCie Biggest Quadra connected to an eSATA PCI card. I keep encountering dropped frames on capture. Could this be due to the PCI connection? To the best of my knowledge, the PCI slot is a separate bus from the Firewire bus, which should avoid the pitfalls of i/o on the same Firewire bus. What could be the problem here? Thanks in advance.

    If you have a MacBook Pro, then yes the ExpressCard bus is separate form the firewire bus. The pros here ALWAYS recommend capturing via firewire to a different bus, either firewire or eSATA via an ExpressCard (or PCI for the previous generation laptops) since the card is on a different bus. Have you tried attempting a capture to the inter drive? I know this is in no way ideal, but this way, we can rule out the camera/deck. DVCAM also isn't much bigger than DV if at all, so bandwidth shouldn't be a problem. Again, not ideal, but try connecting the big disk to the other firewire port on your MBP. This way we can rule out the eSATA card. Report back and we'll see what else we can do to help.
    Don't forget to rate if this was helpful,
    -Brian

  • I need to change my e-mail address in the app store to enable me to get updates and buy more. How does this happen??

    I need to change my e-mail address in the app store, how does that work??

    On apple website, seraching on support, the article HT1918 explains.
    Log into your apple ID and edit your personal information, where email can be changed as well. All applications as itunes stores, apple store and icloud use this same apple ID, so be aware of this.
    I hope I was helpful !

Maybe you are looking for