Displaying large image in Swing 's Frame

Hi,
I'm new to java swings please let me know or sample code of how to display a complete large image in to a small container so that the image should be compressed and the complete image should be fitted into the container.
Thanks in advance

jameel wrote:
please send me the sample working codeNo.
Come on now. We are all volunteers here, and this is not a code-spitting factory. Search with Google, or search the forum, or create your own code. You are then welcome to present your own code here and ask questions about it, but you must do the brunt of the work here. Got it?

Similar Messages

  • Displaying large images in MIDP 2.0

    Hello,
    I've been building a little file browser in MIDP 2.0. Now I'd like to add some file opening in, too.
    Videos and sound can be played quite easily using the MMAPI.
    But images are a tougher case. I haven't found any way to display images using the MMAPI, and loading big images with Image.createImage causes an OutOfMemoryException.
    So, does anyone know a trick (extensions are OK too) to display large images with? Naturally downsizing, as in the case of videos, is OK too.
    -- Mikko

    about image resizing, it is very difficult issue.
    I did this code for my company in 2 whole weeks. and sure I can not post it.
    pluse this code was only for Jpeg files.
    I still can give u some hints,
    1- There is open source code I dont remeber its name ,I think it was JPEG Decoder for J2ME try to search for this.
    this code is said to be for J2ME, pulshit . when u just instansiate instance from this class u got OutOfMemory Error. but this code still good as concept.
    2- Use the previous code to do the decoding while reading, I mean u will have to open stream on ur file then decode the data and resize.
    Good Luck

  • How to Display an Image in swing

    I Want to display an image in swing using the scrollPane, so I can scroll an image in a box

    A very simple way is to use a JLabel :
    JLabel label = new JLabel(new ImageIcon("myImage.jpg"));
    JScrollPane scroller = new JScrollPane(label);

  • Displaying Large Images and Out of Memory Error

    hi,
    I am relatively new to JAVA and I have been trying to display a large jpeg in a scrollpane. The image is about 30 mb in size and is very long. When compressed the image is very small (1mb) but when uncompressed it increases in size due to the black background. I have been looking all over the place to find a method to display such a large image. I read a little bit about the JAI and its tile features but I am not really familiar with it. Also the image has to be displayed in an applet. the whole mess has to do with the JAVA VM memory restrictions as it does not have enough memory to process the image. Is there a way to uncompress a part of the JPEG and display it or assign addittional memory to JAVA. I will really appreciate any help on this topic.
    thanks

    Hiya.
    I can't say I know how to save Java from large images, but you can up the memory allocated to the JVM:
    java -Xmx120M ...
    will give 120M to the JVM (max). There is an -Xms also which gives the initial allowed space.
    Regards.
    Paulj.

  • Displaying large images

    On blog or news item pages etc. it would be common to display
    an image as no more than a certain width, regardless of the actual
    image size, simply for fast loading and consistent visual
    presentation. However, I would like users to be able to see the
    image full size if required.
    The obvious approaches are when clicking on the image, to
    either show it full size in the current browser window or to create
    a new window to show it, probably using JavaScript to open a window
    the same size as the image.
    Both have their pros and cons and the other issue is that it
    is always annoying to click on an image only to discover that the
    original was no bigger anyway!
    Does anyone have any thoughts on how best to handle images?
    Thanks.

    > On blog or news item pages etc. it would be common to
    display an image as
    > no
    > more than a certain width, regardless of the actual
    image size
    This is mistaken. A large image will fetch as its native size
    regardless of
    how you display it on the page.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "UsuallyConfused" <[email protected]> wrote
    in message
    news:f7i90a$lns$[email protected]..
    > On blog or news item pages etc. it would be common to
    display an image as
    > no
    > more than a certain width, regardless of the actual
    image size, simply for
    > fast
    > loading and consistent visual presentation. However, I
    would like users to
    > be
    > able to see the image full size if required.
    >
    > The obvious approaches are when clicking on the image,
    to either show it
    > full
    > size in the current browser window or to create a new
    window to show it,
    > probably using JavaScript to open a window the same size
    as the image.
    >
    > Both have their pros and cons and the other issue is
    that it is always
    > annoying to click on an image only to discover that the
    original was no
    > bigger
    > anyway!
    >
    > Does anyone have any thoughts on how best to handle
    images? Thanks.
    >

  • How to display large image using JAI

    dear all,
    could anyone tell me how do i display an image which is around
    5000x5000 pixels in JAI. I try to use BufferImage to store the image
    but JVM throws" out of memory " error while program is running.
    thanx a lot!

    just a rough estimate, but a 5000x5000 image would require at least 24MB assuming each byte is one pixal, I believe they are 4 bytes per pixel in RBGA format. (5000*5000) = 25,000,000 pixals /1024/1024 = 23.8MB for 1 byte pixals, *4 for 4 byte = 95.3MB. I'm pretty sure that this is how it stores it. Maybe I'm wrong but it certainly explains the situation. assuming you have at least 256MB ramm, run java with -Xmx200M and see what happens.
    java -Xmx200M app
    or if you have more ramm, like 512, use 450 or 500.

  • How to display large image in JAI

    dear all,
    could anyone tell me how do i display an image which is around
    5000x5000 pixels in JAI. I try to use BufferImage to store the image
    but JVM throws" out of memory " error while program is running.
    thanx a lot!

    Hi,
    do you want to work with the image or do you only want to show it into a container?
    you can increment the JVM Memory available space. Or you can split the image into smaller BufferedImage, draw it and call the gc...

  • So frustrated!!!! mouseover to display larger image

    I've searched all day for the answer, been sent 400 lines of
    code that I couldnt understand, read the tutorials... got nowhere.
    so, here we go...
    I have 3 images. 'Front.gif' 'back.gif' and 'detail.gif. I
    sell dresses. I want the user to be able to click on the small gif
    'front' and for the large image of the front of the dress to appear
    (on the same page but different location to front.gif). Then the
    user clicks on 'back.gif' and the front picture of the dress is
    replaced with the back view. then repeat for the 'detailed' view of
    the dress.
    all pictures/photos the the dress (front, back and detail)
    are the same size.
    I've tried layers, rollovers, swaps, crazy code that got me
    half way. I feel like dreamweaver is laughing at me saying "just
    click on that blue button and thats it"!!!!!
    thanks, kitty

    "Michael Fesser" <[email protected]> wrote in message
    news:[email protected]...
    > .oO(P@tty Ayers ~ACE)
    >
    >>"Michael Fesser" <[email protected]> wrote in
    message
    >>news:[email protected]...
    >>
    >>> I understood it like this: There are some small
    pictures and a single
    >>> area to show a large image. If you click a small
    image, a larger version
    >>> will appear in that specific area of the page.
    The same thing happens if
    >>> you use the eBay gallery to attach multiple
    images to an auction.
    >>
    >>Well, here's what she said:
    >>
    >>[...]
    >
    > I know what she said. Question is how you understood it.
    I've understood
    > it the way I described and how I've seen it done many
    times on all kinds
    > of websites: shops, eBay, galleries, even Flickr albums
    look like that.
    >
    >>Clicking a small picture of the front of a dress
    makes a similar larger
    >>image appear. So far so good.
    >>Then, say I'd like to see a picture of the back of
    the dress, and a
    >>detailed
    >>view. How can I find those? Pretty much only by
    random guessing and
    >>clicking
    >>everywhere, because to see the back you have to click
    on the front, and to
    >>see the detailed view you have to click on the back
    view.
    >
    > Ah, that's the ... hmm ... what is "des Pudels Kern" in
    English?
    > www.dict.cc suggests "The gist of the matter"? Anyway.
    >
    > Of course this would be a confusing and user-unfriendly
    design. But it's
    > not how I understood the OP. To me it seemed to be
    intended more like
    > this:
    >
    > +--------+ +-----------------------------+
    > | | | |
    > | front | | |
    > | | | |
    > +--------+ | |
    > +--------+ | |
    > | | | |
    > | back | | big image |
    > | | | |
    > +--------+ | |
    > +--------+ | |
    > | | | |
    > | detail | | |
    > | | | |
    > +--------+ +-----------------------------+
    >
    > As said - quite common.
    >
    > At least I think I've understood your interpretation of
    the original
    > posting now and the problems you see with it. Now it's
    up to the OP to
    > make things clearer. ;)
    >
    > Micha
    Ok, maybe you're right.
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

  • Resize and display large images at high frame rate.

    Hi,
    I am looking for some suggestions on how to implement fast image display.
    I have a device which creates 3000x3000 data arrays which I then convert into images. The device can output this data at anywhere from 5-50fps.
    For display these are then resized to about 500x500 pixels.
    The problem I have is that the resizing part of the process is quite slow and takes around 3/4 second .
    So does anyone have an suggestions on I can get the images to the screen at a reasonably quick rate ?
    I guess I need some sort of queue but has someone an example of how to do this ?
    Thanks,
    Paul

    Hi Rox,
    How are you verifying that you are loosing the frames during the saving and not during the acquisition? Are you able to determine where you are dropping frames? Is it at the beginning, the end or randomly? Thank you!
    Regards,
    Kira T

  • How do you display an image on a frame or panel?

    Can anyone tell me or point me towards a resource that explains how to display an image on a java fram or panel?
    Thanks,
    Eric

    You can create a JLabel with the image and then add the JLabel to the frame/panel.

  • How to dispaly large images?

    Hi!
    I have a simple problem, hope somebody could help me!
    I would like to display images from a LONG RAW type column of an Oracle database (Oracle8i Enterprise Edition Release 8.1.6.0.0) in a BC4J application. I use JDEV 9.0.3.
    The wizard generated entity object's attribute type for the image field is raw, i could not find the LONG RAW type in the java types. The maximun size of the raw type is 2000 bytes, so my app can not handle and display large images. How could i solve this problem? Pls help me!
    I have read the otn forum tips, but they did not help me :((
    Thanx
    Bence

    You may try mapping your column to BlobDomain!
    If that doesn't fit the need, you'd have to create a similar LobDomain (see BlobDomain.java source in bc4jdomorcl.zip) for LongRawDomain so that it uses streamnig apis to fetch data from jdbc rather than using a column-value fetch.

  • Safari 8.0.2 garbling large images

    I am having issues displaying large images with Safari 8.0.2 that worked fine with earlier versions of Safari (e.g., 7.0.4) and in Firefox 35.0. An example image (containing a radargram and ground track map from the south pole of Mars) that is affected is here:
    http://data.boulder.swri.edu/than/Safari_8_0_2_problem/UPB_941801000_1_10_browse _A.jpg
    A screenshot showing the result I am getting in Safari (garbled) compared to that in Firefox (how it should look) is here:
    http://data.boulder.swri.edu/than/Safari_8_0_2_problem/Safari_v_Firefox_radar_im age.tiff
    Any help as to the cause and a solution for this problem would be greatly appreciated!
    Thanks.

    1. From the Safari menu bar, select
              Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data...
    and confirm. Test.
    2. Select
              Safari ▹ Preferences... ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.

  • How to read local large JPEG files and display into Images Tile

    Hi all,
    I can read the local multiple files by FLEX/AIR FileListEvent
    and loader to read the large JPEG files but cannot display them
    into a TileList. Since it is a number of images files, how can I
    put them into a thumbnail TileList.
    Please kindly advise.
    Regards,
    Billy

    1. So I would like to know which is the {color:#3366ff}best way to load local images in ImageView{color}.I'm no expert, but is there a reason that you are using Swing to do the loading?
    2. secondly, currently the system displays all images only after the completion of creating all images. {color:#3366ff}How to display images as and when they are created.{color} So that the user has a feeling that the images are loading.JavaFX Image class let you display a lightweight placeholder, and you can bind the progress to some kind of visual indicator. I don't think you can display an image that is partially loaded.
    def PATHS: String[] = [
        "C://Ariel Atom//ariel-atom-1.jpg",
        "C://Ariel Atom//ariel-atom-2.jpg",
        "C://Ariel Atom//ariel-atom-3.jpg",
        "C://Ariel Atom//ariel-atom-5.jpg"
    function getImage(path: String): Image {
        Image {
            url: "file:///{path}"
            backgroundLoading: true
    Stage {
        title: "Image Tiles"
        width: 1024
        height: 800
        scene: Scene {
            content: [
                Tile {
                    columns: 2
                    tileWidth: 400
                    tileHeight: 400
                    content: for (i in [0..3]) {
                        ImageView {
                            image: getImage(PATHS)

  • How to load a large image for display on the Palm PDA

    Hello:
    I have a large image I would like to display on LV for Palm PDA. The documentation states there should be a 64K chunk limitation for VIs to compile on the Palm. Therefore, I decided to break this image up into 2D arrays of less than 64K per subVI. My 3.2 Meg image therefore has about 224 2D array subVIs. My motivation is to somehow use the build array function (with concatenate inputs) to reconstruct the image at runtime. I can compile each 2D array subVI as a test, but my attempt to reassemble and compile is futile. When I try to use the build array with only 8 of these subVIs in a top level VI the compiler complains its still too big of a VI. Using get info, memory for this top level states total ~2
    3K of memory usage.
    So can someone help me with this problem. Is there another way to load this size of an image into memory so I can display it on a picture control?
    BTW, this can build on LV for PocketPC.
    Thank you
    Robert

    Hi Robert,
    You are correct in that one of the limitations of the Palm OS is that files cannot be larger than 64 KB in size (as stated on page 5-3 of the LabVIEW PDA Module User Manual). The suggested workaround is indeed to have a top-level PDA VI that calls subVIs, and this top-level VI can then have a total file size larger than 64 KB.
    My suspicion is that with the picture control on the Palm OS, even if you are breaking up the image into smaller subVIs, the process of building the array to reassemble the picture is still forcing the Palm to allocate memory for each of those 2D array subVIs to place on the top-level VI's picture control
    and thus causing the Palm to complain about not having enough memory. The LabVIEW PDA User Manual also states that "There is a total limit of 64 KB on all front panel array data". Thus, when you are trying to use the build array on the top-level VI, the 64 KB limit on front panel array data is still being exceeded -- even with only 8 of these subVIs.
    The following KnowledgeBase article KB 38EJRHFQ: How Do I Put a Picture or Image on My LabVIEW PDA for Palm Front Panel? states that as a workaround, you can shrink the size of your image by using 4-bit or 1-bit data instead of the standard 8-bit pixmap representation.
    This is really just a limitation of the Palm OS and the fact that there is simply no way of displaying that much front panel information for your picture. Either way, you would need to build up the array of pixels for your bitmap, and for a 3.2 MB image, I don
    't believe there is any way for the Palm OS PDA to display the image in its entire at once.
    Sorry about that...
    Kileen C.
    National Instruments

  • Large images not displaying properly in Acrobat Pro 9

    When creating PDF documents from any software (Illustrator, Corel, InDesign, etc), color objects over 50% of the page size have white fill. If object has an outline, the outline will appear normally, but the fill will be white. I've searched forums everywhere and have found no answer. Most forum topics on this are issue focus on settings in the program that exported the PDF. I am 99% sure this is not an export problem, but is something in Acrobat itself (a missed setting? Corrupt program file?)  
    To provide the best information, I've done a little scientific research. Here is what I know:
    Currently running Acrobat Pro 9.5.5
    This is only happening on ONE install of Acrobat 9. Documents display correctly in Reader X and in Acrobat 9 on other machines.
    Started happening a few weeks ago, I have no idea what changed.
    "Show Large Images" in preferences dialog is checked. Unchecking it and rechecking it does nothing.
    Have installed all available updates to the software
    I experimented with different object sizes. At 50% of page size, objects appeared normal, at 51% filled object disappears.
    Does not affect photos, only affects vector objects.
    I welcome all ideas to fix this.
    ALSO - Am running this on Windows Vista 64 Bit

    Hello? Is there nobody in the Adobe universe that has an actual solution to my problem?
    Other things I've tried to solve this:
    repair the install.
    uninstall and reinstall
    cuss at the computer
    throw a tantrum.
    I will pay someone a whole dollar for a solution that works.

Maybe you are looking for

  • Problem with GuardianEdge and Discoverer export

    We're having problems doing XLS or SLK exports out of Discoverer Plus 10g and appears to only be happening on PCs where the GuardianEdge encryption product has been installed. In fact, we can export to a shared drive (i.e. server not protected by Gua

  • Is it possible to synce back iMessages in Messages?

    So, I was just tonight enlightened of the evolution of iChat to Messages in the Mountain Lion release. I realize I am late to the game. That said, I am here now and really love this new amazing feature. BUT...is it possible for iMessages sent/receive

  • Playlists won't play

    itunes 9.0.1 windows 7 clicking a playlist just plays the first song even though the boxes are all clicked. Also can't change the order by drag and drop. Whats up doc?

  • Doubt in KT4A-V

    hi why if in the description of the mb it says that suporta agp 8x,  in the bios I just can select until 4x? somebody knows why? thanks

  • Changing a Single Threaded app into Multi Threaded app

    Hi Java Experts I made a web crawler that goes out to a particular web site and starts from there to crawl throughout the internet -- it's working fine . it only has 1 thread -- which is the main class which implements runnable. I'm interested in mak