Catch the image of JTree and save it as a file

There is an JTree and it has a few nodes.
And there, I want to capture both the image of JTree and
the images of it's child nodes as they show in screen.
if possible, I want to capture image of all expanded nodes in tree and
save them as jpg file.
I try to capture the Image of JTree from JTree.createImage() method.
and I also tried to capture the images of child nodes
from JTree.getComponents() and capture images all of child nodes as they were.
I,however,get to know the method
Component.createImage() doesn't return the image that shows in screen as it was.
could anybody tell me the answer?

Hi,
don't know if I got you right, but what you want is a "screenshot" of the JTree, right ?
Try to paint the JTree in a BufferedImage and encode this as JPEG or whatever.
BufferedImage theImage = new BufferedImage(
      owner.getWidth(), owner.getHeight(), BufferedImage.TYPE_INT_RGB);
      Graphics g = theImage.createGraphics();
      g.setClip( 0, 0, owner.getWidth(), owner.getHeight());
      owner.paint( g);owner is your JTree or any other component you want.
Hope that helped.

Similar Messages

  • Png blurry/pixelated after i used the vanishing point filter and save as a VSP file?

    Hi,
    Why are my png blurry/pixelated  after i used the vanishing point filter and save as a VSP file? And i'm using a high res picture. I'm using PS CC.
    I got some screenshots.
    This the result of the png
    Thanx in advance

    As I posted before, I would use it more if it had some of the functionality I need. I need to be able to change the opacity of the image I'm pasting so I can see EXACTLY where my overlaid image will register with the bottom image. VP seems to require a ton of processing and I wonder if maybe the software is handing off some of this work to the graphics card for calculating. Maybe this would explain that apparently not many people have run into an error that gets embedded in the file. Although my G5 is Apple stock, not super-modified.
    craig

  • Transform implementation goes wrong when I try transforming a image through script and save the new image using a HTML to canvas plugin.

    Transform implementation goes wrong when I try transforming a image through script and save the new image using a HTML to canvas plugin. The rotation comes up fine, but the origin of the transformation is faulty (compared to other browsers like Chrome & IE)

    A good place to ask advice about web development is at the mozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.

  • Inserting image to jFrame and save it in a sql database

    Hai guys, I have a problem in inseting a image in jfame and save it in database (my sql)
    does any one have an idea about this task reply me pls
    thanks
    bay !

    Use BLOB (Binary Large Object) to save your image to a database.
    As far as displaying a image on Jframe, search the forum.

  • Firefox upon opening an image in a new tab, centers the image from top and bottom and surrounds the image with a grey frame. Just started having the problem today, searched Google to no avail.

    Firefox upon opening an image in a new tab, centers the image from top and bottom and surrounds the image with a grey frame. Just started having the problem today, searched Google to no avail.

    Oh wow, looks like a new feature.
    The "page" links in a stylesheet with the address "resource://gre/res/TopLevelImageDocument.css". If you remove that reference, then the image displays in the old style.
    '''''Edit: Please skip the rest of this post and check out the next one.'''''
    There might be a more elegant solution than that, but you could use a bookmarklet to strip out that link when you want to view the page in its old style. A bookmarklet is a snippet of JavaScript you save on the Bookmarks toolbar for quick access.
    First, copy the following code to the clipboard (it's all one long line):
    <br>javascript:var ssheet=document.querySelector('link[href="resource://gre/res/TopLevelImageDocument.css"]'); if(ssheet)ssheet.parentNode.removeChild(ssheet); void 0;
    Next, if you are not displaying the Bookmarks Toolbar, use View > Toolbars > Bookmarks Toolbar to display it. (If you aren't using the classic Menu bar, press Alt+v to call up the old View menu. Right-clicking the gray area just below the page address also allows you to display the Bookmarks Toolbar.)
    Right-click on the Bookmarks Toolbar (or Mac equivalent of right-click!) and choose New Bookmark.
    Paste the code into the Location box (the second box).
    Then type a useful name in the Name box (e.g., Oldstyle Picture) and click Add.
    Now, when you want to tweak the image display, click the button to run the script.
    Manual clicking is a hassle, so it might make sense to look into other solutions. (Greasemonkey didn't seem to work; I think it might not run on .jpg files.)

  • A library on my hard drive became corrupted, so I over-wrote it from an external hard drive.  When I access the library now on my hard drive, many of the images are vertical, and cannot be rotated other than one at a time.  Ideas to correct this?

    A library on my hard drive became corrupted, so I over-wrote it from an external hard drive.  When I now access the library on my hard drive, many of the images are vertical, and cannot be rotated other than one at a time.  Ideas to correct this?

    You had already done "Repair" and "Rebuild"?  These usually takes scores of minutes or hours.
    Does the Library on your external drive work from the external drive?  Navigate to it in Finder and double-click the name.
    If it does, delete the problem Library, empty the System Trash, reboot, Verify your system disk using Disk Utility (and might as well repair permissions while you're at it), reboot, test the external drive Library once more to confirm it works properly, then close it and copy the Library to your system drive.  When the copying is done, double-click the Library (now on the system drive) and see what you get.

  • When I set all the tracks in the latest Garageband to the same volume levels and save, when I open the file again they've changed back to a previous setting?

    I'm trying to mix a recording in the latest 2014 version of Garageband, but when I set all the tracks in the latest Garageband to the same volume levels and save, when I open the file again they've changed back to a previous setting? Does anyone know why it changes even after saving the file?
    Below is my iMac settings.

    Do you have a back up?
    If not you're into using file recovery software like  File Salvage - you can download a free trial and it will scan the disk for you and tell you with might be recoverable. Actual recovery will require that you purchase the app. There may be many files with the same or similar names. Always recover the largest file size.
    There are other such apps. Search on Macupdate or the App Store

  • So I have been creating a logo for my company and it came out great. The problem is, when I format it for PNG or when I want to use it on freshbooks or my webpage, the image becomes blurred and the text is not as clear. How do I fix this?

    So I have been creating a logo for my company and it came out great. The problem is, when I format it for PNG or when I want to use it on fresh books or my webpage, the image becomes blurred and the text is not as clear. How do I fix this? Is it because the text get shrunk?

    This is how it looks on adobe illustrator

  • When using Firefox certain videos play but the image is green and distorted.. help?

    Firefox 3.6.8 and 3.5 (I downgraded to see if that would solve the issue)
    Windows 7
    Intel Core i5
    Flash Player: WIN 10,1,53,64
    When using Firefox certain videos play but the image is green and distorted. The image turns into lines and sometimes it half of the screen of the video. Examples are streaming MLB.tv video and some vimeo videos. The odd thing is that it isn’t all Vimeo videos. Is this a flash issue?
    The issue does not happen with Internet Explorer which leads me to believe this is an issue with Firefox. I downgraded to 3.5 and the issue still persists.
    Screen Caps: http://yfrog.com/1x46496103j and http://yfrog.com/n112309689j
    Any help?
    == URL of affected sites ==
    http://

    Try disabling hardware acceleration in your [http://www.macromedia.com/support/documentation/en/flashplayer/help/help01.html Flash settings] (using Firefox, right-click on any Flash object on a webpage, select Settings, uncheck "Enable hardware acceleration on the Display tab).
    Ref:
    http://kb.mozillazine.org/Flash#Performance_or_display_issues_with_certain_Flash_videos

  • What is the difference between pause and save in Hyper-V?

    hi,
    What is the difference between pause and save in Hyper-V?
    What are the benefits of using each function?
    Thanks

    WHen you save VM, Hyper-V saves VM state to disk and frees all memory and CPU resources used by VM. When you pause a VM, Hyper-V saves VM cpu state in memory, and then stops VM's cpu processes without releasing its memory. Since no disk operations are involved,
    pausing and resuming can be done much faster than saving and restoring a VM.
    Gleb.

  • I previously uploaded images onto my desktop to work on in Lightroom 5.2. I worked on a few of the images days ago and just now getting back to them. My problem is I can only access the images I previously worked on and all the rest it says images not ava

    I previously uploaded images onto my desktop to work on in Lightroom 5.2. I worked on a few of the images days ago and just now getting back to them. My problem is I can only access the images I previously worked on and all the rest it says images not available but all the images are still right on my desktop.

    ... and all the rest it says images not available
    Normally this happens because you moved, renamed or deleted these photos (or the folders that contain them) outside of Lightroom. This is how to fix the problem: Adobe Lightroom - Find moved or missing files and folders

  • Flash changes the image's colour and quality

    Hi,
    I've been working on an animation with the image fading in and zoomin in. However, I noticed that the image has different colour in a flash animation from the same image used on the same website as an image in a  jquery gallery.
    Here are the links:
    flash animation
    image in a gallery  -  (4th image from the left)
    The other thing is, when animating image in flash, it looses its quality and becomes a bit pixelated. Why is it happening?
    I would appreciate any help.

    If you are animating the image, you should set the smoothing property of the image to be true.  If you have the image in the library, then right click it in the library, choose Properties, and select the option to Allow Smoothing.  This should help with pixelation and other impacts of animating the image.
    You might also adjust any other settings in that same interface.  It is possible the color change is due to optimization settings in Flash.

  • When I send a jpg to a PC in Mail. The image gets embedded and can no t be downloaded. How do I keep it as an attachement?

    When I send a jpg to a PC in Mail. The image gets embedded and can no t be downloaded. How do I keep it as an attachement?

    In you broswer? I'm using Mail App that came with My Mac. Do you know how to do it through there?

  • TS3899 When i send an image via gmail on my iphone 5s, the message gets sent, but when received, the image is invalid and the mail message says that it has noncontent. I've tried turning off the phone completely, deleting all mail accounts and then reinst

    But when received, the image is invalid, and the mail states that the message has no content. Help, please!

    Hello Bunk94,
    It sounds like iMessage may be activated with the wrong phone number. Let’s see if we can resolve this. First, go ahead and sign out of iMessage and FaceTime:
    If you can't send or receive messages on your iPhone, iPad, or iPod touch - Apple Support
    http://support.apple.com/en-us/HT204065
    Sign out and back in to iMessage and FaceTime
    Go to Settings > Messages > Send & Receive, tap your Apple ID, then tap Sign Out.
    Go to Settings > FaceTime, tap your Apple ID, then tap Sign Out.
    Afterwards, turn iMessage and FaceTime off and restart your device:
    If you get an error when trying to activate iMessage or FaceTime - Apple Support
    http://support.apple.com/en-us/HT201422
    Turn off iMessage and FaceTime and restart
    Go to Settings > Messages and turn off iMessage.
    Go to Settings > FaceTime and turn off FaceTime.
    Restart your device.
    Turn iMessage and FaceTime back on.
    Thanks,
    Matt M.

  • FV70 what is the difference between Park and Save as completed?

    HI,
    Can anyone explain, what is the differences between Park and Save as completed in t-code FV70?
    in FBV0 post park document, I still can post both document?
    Thanks

    Hi,
    The main difference between park and save as completed is that in "Save as Completed", system do some checks as it do in posting the ocuments, like:-
    (1) Balance should be zero.
    (2) All lines should have been filled with the required data.
    (3) There should be at least two lines in the document.
    Regards,
    Gaurav

Maybe you are looking for

  • DNG camera profile - which to trust, Adobe's or X-Rite's?

    I found that dual-illuminant DNG camera profiles created with X-Rite's ColorChecker application and Adobe's DNG Profile Editor give different visual results (the profiles were produced using the same set of 6500K/2850K illuminated photos). I'm now in

  • Page Not Responding (Streaming PDF)

    I'm not sure if this is related to my code or just the app I'm customizing, but here is the problem. I'm using FOP (Apache's Formatting Object's Processor) XML Graphics project. In any case, I'm creating this PDF on the fly and then streaming it back

  • HT1657 Movie rentals

    How do you transfer a downloaded rental movie from the computer to another device, Apple TV?

  • Is it mandatory to use MDS?

    We are creating a portal which will contain static content and no run time customization of pages. Also, WebCenter Spaces or SOA is not used. The database would be required for the applications, however. I want to ask if it is mandatory to use MDS in

  • WL 6.1 sp3 hanging, requests time out

    Hi, We're using WL 6.1 with SP3 and a patch - CR080901_61sp3.jar - has been applied. The server runs on a 4 CPU NT Server. We observe that under moderate load conditions (200 concurrent users), the WL server stops responding to requests. The thread c