Displaying dynamically changing image: a problem with JLabel.

Hello! I use NetBeans 5.5 and I develop my GUI with Matisse. I'm rather a beginner in developing GUIs with this editor...
I'd like to display a dynamically changing image. The idea is: GUI shows the image, that is modified as some computations run in a different thread. App will be run on a single machine.
I'm trying to display the image as a label's icon. The problem is that my app's frame can be resized - and when it is, the label also resizes. When the label is resized, the image should also be resized - the image should always be of the same size as the label. The problem? I noticed, that it works only when I make my app's bigger. When I try to lower its dimensions, the label's dimensions remain the same. Why the label don't make its size smaller?
My code works as follows: when app's main frame is resize, the panel (the one, that the label is placed in) is also resized. And, since the label is in the panel, it (should) also be resized. So I wrote all the resize-events handlers (therefore I know that the resize event is sent when my app's frame is resized, and when the panel is resized - but the label is resized only when it grows bigger). In this methods I modify the image displayed in the label (I resize the image).
Or, perhaps, there is some other way to show a (dynamically changing) image with Swing... I chose JLabel, because I didn't want to write my own JComponent. JLabel can display image and that is all I need. The problem is: when the label grows bigger, I create a new, bigger image (icon). Why my label don't get smaller (the resize event isn't even sent)?

There is no component that dynamically resizes an image. You need to create your own. Something like this:
JComponent component = new JComponent()
     protected void paintComponent(Graphics g)
          //  Scale image to size of component
          g.drawImage(yourImage, 0, 0, getWidth(), getHeight(), null);
};

Similar Messages

  • Weird image distortion // Problem with game

    Hello,
    Im making a tiled based multiplayer game and everything is going fine however Im having a problem with image displaying.
    Here is how it looks like when I play it on my server computer as well as on my laptop:
    [http://s278.photobucket.com/albums/kk112/beloxx/?action=view&current=ss.jpg]
    And here is how it looks when I play it on my brother's computer:
    [http://s278.photobucket.com/albums/kk112/beloxx/?action=view&current=ss2.jpg]
    The image on the latter computer is distorted.
    I used to test my game on that computer before and everything was fine. I tried rebooting it but its still not displaying right. Right after I run the game the image is fine for a split second and then it becomes distorted...
    Did anyone have a similar problem?
    Here is the link to my home computer server:
    [http://belox.gotdns.com]
    or just go to:
    [http://74.56.212.14]
    The server may be slow or down so dont get frustrated if it take slong to load.
    Could you tell me whats your images look like when u run the game?
    Id really appreciate it if you helped me.

    Ok, the server is up and running right now so could you guys go to [ http://belox.gotdns.com| http://belox.gotdns.com] and see if your background image is distorted like in the screen shot above?
    Thanks

  • Image loading problem with weblogic security page

    I developed an j2ee application on tomcat server. After successful working in tomcat I migrated to weblogic server.
    So problem is the application is working properly with out security in weblogic. Later security is added to the application, then the back ground images are not loading in .jsp pages. Please suggest me what i have to follow to display back ground images in the .jsp pages. I was unable to find solution.
    Thanks
    Ananda

    Hi,
    There is a BADI (TRIP_IMP_EXP) that can help you to restrict trip amount by set delimit date.
    Use RESTRICT_TRAVEL_RANGE method ot do this.
    BR, Jurijs

  • Image size problem with Retina Macbook Pro

    I exported raw images to Jpg and then resized as 1200 x 800 resolution images through "Easy batch Pro" app. When I uploaded them, they were extremely large. I've tried it several times and the result was always the same. Is it a problem with "Easy batch Pro" app, or something with Retina Display resolution? I also resized them as small size like 600x400, but the image was totally broke, and apparently had different look when I saw the original via aperture. What should I do?

    What's the problem exactly?  Call and complain.  It's up to them on how they want to handle it, but if it's something normal or minor, they'll just fix the issue under warranty and send you on your way.  That's how warranty works.  In instances where a user has had repetative failure of the same kind or others with the same system, a complete replacement was done, but those were issues that border on the "it's a lemon" idea.

  • Alpha transparency borders on dynamically loaded images for use with textures

    Hi there folks. Well, I have been beating my head over this
    and am hoping one of you can help me out.
    Essentially I have 16bit images that are loaded into my
    shockwave application at run-time. These images are user defined
    which means that I will not know their size ahead of time. Once the
    images are loaded I then create textures and apply them to various
    shaders. Ok, all of this works just fine. What I need to do though
    is create an alpha transparent border around the images, so when I
    apply them to their surfaces I only see the image and nothing
    around it. I am doing this because these images will only appear at
    specific parts on a surface, textureRepeat will be false, and many
    models will be stacked in the same exact location using the same
    model resource. I have everything working, but I cannot figure out
    the alpha part for the life of me. Also, when I test the alpha
    based image by itself it works just fine. It is not until I try and
    combine the 16bit (converted to 32bit at run-time) image that I run
    into problems.
    I have tried:
    - Creating a 32bit alpha image in Fireworks with a
    transparent border and a black rect for the inside. I then copy the
    dynamic image over the alpha image (only after going from 16bit to
    32bit in imaging Lingo) and leave a little room at the edges for
    the transparency. Well, I get a crazy amount of streaks here even
    when I try to up the trans border by around 24 pixels on each side.
    - Using another similiar alpha based image as a mask with
    copyPixels and extractAlpha/setAlpha like this... (code is a little
    rough here)
    newImage = new(#bitmap)
    newImage.name = "place_Test"
    newImage.image = member("place").image
    newAlpha = new(#bitmap)
    newAlpha.name = "AHH"
    newAlpha.image = image(newImage.image.width + 24,
    newImage.image.height + 24, 32)
    newAlpha.image.useAlpha = true
    newAlpha.image.copyPixels(member("vase").image,
    newAlpha.image.rect, member("vase").image.rect)
    newAlphaInfo = newAlpha.image.extractAlpha()
    newAlpha.image.useAlpha = false
    --reverse dark to light
    iAlphaReverse = image(newAlpha.image.width,
    newAlpha.image.height, 8, #grayscale)
    iAlphaReverse.fill(iAlphaReverse.rect, rgb(0,0,0))
    iAlphaReverse.copyPixels(newAlphaInfo, iAlphaReverse.rect,
    newAlphaInfo.rect, [#ink : #reverse])
    --newAlphaInfo.copyPixels(iAlphaReverse, newAlphaInfo.rect,
    iAlphaReverse.rect, [#ink:#subtractpin])
    newAlphaMask = iAlphaReverse.createMask()
    rescaleAbs(newImage, newImage.image.width,
    newImage.image.height, "place_Test", 32)
    destImage = member("place_Test").image.duplicate()
    destImage.fill(destImage.rect, rgb(0,0,0))
    newAlpha.image.useAlpha = false
    destImage.copyPixels(newImage.image, newImage.image.rect,
    newImage.image.rect, [#maskImage:newAlphaMask, #ink:#add])
    destImage.setAlpha(iAlphaReverse)
    destImage.useAlpha = true
    member("place_Test").image = destImage
    I apologize for the messy code. I have cut and pasted from
    all over the place and am getting confused. In any case, I think I
    am making this harder then it needs to be and hope someone can
    help.
    Thank you in advance,
    Dave

    Hi, you can try using other texture layer as mask on the same
    shader. As usually you create the texture from a dynamic loaded
    image, then apply this texture to the shader on the texture list
    index 1 (textureList[1]). Next part does the job, create other
    texture from a 32 bits image with the alpha information and fill
    all pixels with white color, this is very important because the
    second texture layer will be multiply with the first texture layer.
    This texture set its render format to rgba8888. Apply the mask
    texture to the same shader at texture list index 2, verify that the
    blendFunctionList index 2 is #multiply.
    I include the code of a project that use this masking
    approach:
    property pMember
    property pEarthSphere
    property pNightSphere
    property pLastTransform
    on beginSprite me
    pMember = sprite(me.spriteNum).member
    me.setupWorld()
    end
    on setupWorld(me)
    pMember.resetWorld()
    repeat with i = pMember.light.count down to 1
    pMember.deletelight(i)
    end repeat
    vEarthModelResource = pMember.newModelResource("EARTH MODEL
    RESOURCE", #sphere)
    vEarthModelResource.radius = 50.000
    vEarthModelResource.resolution = 20
    vEarthTexture = pMember.newTexture("EARTH TEXTURE",
    #fromCastMember, member(3,1))
    vEarthShader = pMember.newShader("EARTH SHADER", #standard)
    vEarthShader.emissive = color(255,255,255)
    vEarthShader.flat = TRUE
    vEarthShader.transparent = FALSE
    vEarthShader.textureList[1] = vEarthTexture
    pEarthSphere = pMember.newModel("EARTH MODEL",
    vEarthModelResource)
    pEarthSphere.shaderList = vEarthShader
    vNightModelResource = pMember.newModelResource("NIGHT MODEL
    RESOURCE", #sphere)
    vNightModelResource.radius = 50.2000
    vNightModelResource.resolution = 20
    vNightTexture = pMember.newTexture("NIGHT TEXTURE",
    #fromCastMember, member(4,1))
    vNightTexture.quality = #lowFiltered
    vNightTexture.nearFiltering = FALSE
    vNightTexture.renderFormat = #rgba8880
    vNightShader = pMember.newShader("NIGHT SHADER", #standard)
    vNightShader.emissive = color(255,255,255)
    vNightShader.flat = TRUE
    vNightShader.transparent = TRUE
    vNightShader.textureList[1] = vNightTexture
    vMaskNightTexture = pMember.newTexture("MASK NIGHT TEXTURE",
    #fromCastMember, member(6,1))
    vMaskNightTexture.renderFormat = #rgba8888
    vNightShader.textureList[2] = vMaskNightTexture
    vNightShader.textureModeList[2] = #wrapPlanar
    pNightSphere = pMember.newModel("NIGHT MODEL",
    vNightModelResource)
    pNightSphere.shaderList[1] = vNightShader
    pNightSphere.parent = pEarthSphere
    end
    on exitFrame(me)
    pEarthSphere.rotate(0.0,0.1,0.0)
    me.moveMaskNightTexture()
    end
    on moveMaskNightTexture(me)
    vRotationVector = - pEarthSphere.transform.rotation
    pNightSphere.shaderList[1].wrapTransformList[2].rotation =
    vRotationVector
    end

  • Image printing problem with Photoshop and Lightroom specifically with 11X14 cuts off top of image and moves bottom border up. Windows 7 OS - Epson Printer is working properly.

    Have an unprecedented problem with printing 11X14 photos in both PS and Lightroom. The printer is operataing properly. Printing 81/2X11 correctly. Have double and triple checked all the printing settings and they are correct. Have checked with friends to no avail. This problem started yesterday. Widows 7 OS. Need help.

    You show the OS receiving an image from Photoshop, and the OS starting the Epson print driver and handing it part of the image, the driver connects to the printer, then the print driver fails. It looks like a bug in the Epson rasterizer, or the printer communication.
    You really need to talk to Epson.  Photoshop isn't involved in that error.

  • Image Capture problems with my MacBook

    When i plug in my camera macbook three different icons show up with it in finder and two different icons show up with it in image capture. my problem is that none of my pictures will show in my image capture. ive never had a problem with this before. please help

    when i plug my camer into my macbook*

  • Image Gallery, problems with Flash player 9 and Opera 9

    Hi, I'm developing a slideshow in flash (and php, JavaScript,
    XML).
    I'm coding in classes and AS2.
    I use the ExternalInterface class to communicate between
    swf's and html.
    The problem is that the Slideshow won't work properly in the
    Opera browser,
    it seems like it's working fine, but after a few click it
    stop responding.
    No problems in IE and FF.
    I've search and search to find a solution to this problem
    with no luck.
    I've put up an example of the slideshow here:
    http://www.coldminer.com/up/sw.php?thumbs=1
    The strange thing is that when I use really simplified
    versions of the code
    I'm using (with no externalInterface etc) it is working fine:
    http://www.coldminer.com/ftest/
    Anyone who have experienced similar problems, and can guide
    me to a solution.
    Opera version: 9.02 (8585)
    Flash player version: 9,0,16,0
    Thank you!
    ** Edit ->
    I found a solution, I replaced th ExternalInterface with the
    "Flash JavaScript Integration Kit",
    and all my problems with Opera was solved.

    Lo stesso problema ce l'ho io. Sembra che flash player 9 non
    riesca a leggere le versioni flash 5. Nell'installare un corso
    contenente flash 5 ho questo errore:
    Prodotto: Corso Multimediale per Photoshop 7 -- Errore 1904.
    Impossibile registrare il modulo C:\WINDOWS\system32\swflash.ocx.
    HRESULT -2147319780. Contattare il personale di supporto.

  • Photoshop CS5 - Image resize problem with move tool

    Hi People
    Here's my problem
    When I try to resize an layer using the move tool (as opposed to the Free Transform tool), while I'm in the process of moving the scaling handles, the bounding box reflects my movement but the layer preview stays at it's original size. When I stop moving the handles there is a few seconds delay and then the new scale size shows up. If I try to move the handles again, without commiting to the transform, the layer preview reverts back to it's original size until I've finished moving the handles.
    I didn't have this problem with CS4 and I've only recently upgraded. I work around this problem by using the proper Free Transform tool (ctrl+t) but it would be nice to know why the hell this happens. It seems to me to be more of a graphical glitch than a software preference but I thought I'd check just-in-case.
    Specs:
    Photoshop CS5 V12.1 x64
    PC
    Intel Xeon W3505 @2.53GHz
    Nvidia Quadro FX580
    12 GB RAM

    ace591 wrote:
    Hi People
    Here's my problem
    When I try to resize an layer using the move tool (as opposed to the Free Transform tool), while I'm in the process of moving the scaling handles, the bounding box reflects my movement but the layer preview stays at it's original size. When I stop moving the handles there is a few seconds delay and then the new scale size shows up. If I try to move the handles again, without commiting to the transform, the layer preview reverts back to it's original size until I've finished moving the handles.
    I also read you you tried updating your video dirvers and your syste crashed and you had to roll back.   Make sure you have downloaded the latest correct drivers. If that does not work try turning off Open GL in photoshops preferences.
    On my old XP 32 bit system CS5 movet tool with transform dialog does not fail like on your system. I can move the handles time and time again without commiting the transform. The only way to have Photoshop revert the transform back to the original state is to press the ESC key to cancel the uncommitted transform.

  • Retina Display MacBook Pro image persistence problem.

    Hello,
    I have recently ( about 3 months ago) bought a Retina MacBook Pro and installed Windows via Bootcamp on it. I unfortunately am used to Windows. Well recently I tried to migrate to OS X and use it more often. Whilst doing so something caught my eyes on the desktop/Screen. There appears to be Ghosting images of the Finder/Safari windows I open which look extremely annoying and terrible for a machine I payed 3000 dollars for. I have contacted Apple support via a phone call and they said they will replace it...the screen...if i brought it and gave it to them myself. The problem is, I live out of the US and I ordered this from a friend that has went there to buy one for me as we both live in Saudi Arabia and the Premium Resellers here sell it for a very high profit rate. My issue is that I live out of the US with a Malfunctioning Laptop worth $ 3,000, and can't send it to Apple as I don't know anybody going there including myself. I have researched and this problem happens only on LG manufactured screens, I have found out mine is also indeed an LG screen via a terminal code I found on the Internet. Is there any way Apple can replace the laptop or the screen from Saudi Arabia as there are premium resellers. The support guy was not very helpful as I was a rare case out of the US and the service of the resellers here said they would like to look at the display, I don't think they would fix it for free...Don't apple devices have an international warranty?
    Thanks,

    an hour on my MBP by itself (someone else's office, a hotel room, an airplane, my lazy sofa) and my eyes lose the ability to focus --and I'm toast.
    Ok, I'll explain why.
    First off your iPad and iPhone screen is smaller, thus doesn't reflect as much as a larger display will.
    Your other displays are in a static environment where you have reduced the glare or it's been reduced just by chance.
    When you take the glossy screen laptop to another location without adequate environmental features to reduce glare imposed (no overhead lights, closed windows, low light etc.) on the screen, thus your getting eyestrain from the glare.
    It's caused by the slightly out of focus reflections verses the screen image, your eyes are automatically refocusing between the two images.
    Your solution in this matter is to apply a anti-glare film to the laptops glossy screen, unfortunately it's going to cost money and be replaced often as it gets dirty, dries out and peels at edges etc.
    Ideally a anti-glare matte screen would be the choice in the first place. I use my Mac for 12 hours a day, 7 days a week and don't have the eyestrain problem anymore.

  • Mail attachment image caching problem with C7

    Using C7-00 and Mail for Exchange with up to date software. I received two Mobile Boarding Pass emails from Lufthansa for my flights. These emails contain barcode.gif as an attachment that one can show at the gate when boarding. Now the two emails contain attachment with same name (barcode.gif) and the images are equal in size too. The problem is that for the second mail the phone shows the attachment of the first email!
    I have read that Symbian^3 has for performance reasons aggressive image caching feature. But in this case this causes a real nasty bug!
     - Juha

    I have found a solution.
    In the IMG src tag we had been using /images/gfx/image.gif
    By changing this to /./images/gfx/image.gif the images are no longer cached and update immediately when changed.
    PQ

  • Dynamic Change event getting error with cascading LOV's

    Hi all,
    In my application (v4.0.0), I have two sets of cascading drop-down select lists, these each make up a date (year, month, day) plus a time value (not cascading).
    I also have a dynamic action that gets the hours difference between the two dates set above. This fires on the change event.
    When I change, say the month drop-down, the day list is refreshed. But before it is refreshed, it looks to be emptied and the change event fires. I then get an error from the dynamic action because the day value passed to the query is empty (confirmed when looking at POST data).
    Can anyone think of a workaround idea for this? e.g. a way to set the dynamic action to conditional?
    Thanks!

    Hi Peter
    Thanks for the tip, I have tried this and it has helped, although not solved the problem. I was originally getting two errors appear ("AJAX call returned server error ORA-01843: not a valid month for Set Value.") and this has removed one of them...
    When looking in Firebug, it seems to me that although the dynamic actions (cascading update + set value) are running one before the other, the values aren't updated in order. e.g. the cascading update is not applied before the set value action is run.
    Could this be a bug with dynamic actions?

  • Intermedia Image transform problem with Tifs 64k

    Hello, I have loaded a bunch of Tifs ranging in size from about 8k up to 120 or so kilobytes. When I try to do a scale transform on them and change them into GIFs using the image.process('scale="0.2"') command for example only the TIf images that are about 64k and under get processed; for the rest I get an unhandled internal exception. I am running Oracle 8.1.5 Enterprise Edition on a Sun Enterprise 250 with .5 gig RAM. Should I reconfigure how much ram is available to Intermedia and if so how do you do that?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by John Wagner ([email protected]):
    Hello, I have loaded a bunch of Tifs ranging in size from about 8k up to 120 or so kilobytes. When I try to do a scale transform on them and change them into GIFs using the image.process('scale="0.2"') command for example only the TIf images that are about 64k and under get processed; for the rest I get an unhandled internal exception. I am running Oracle 8.1.5 Enterprise Edition on a Sun Enterprise 250 with .5 gig RAM. Should I reconfigure how much ram is available to Intermedia and if so how do you do that?<HR></BLOCKQUOTE>
    I directly got in touch with John, and his problem has been sold.
    He sent two Tiff images - a bad one and a good one. An image expert took a look at them. Here is his comment:
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
    I took a look at these images and they seem
    to be "good" - i.e. they are not corrupted or
    in an unsupported format. I tried our new
    version and it handles them OK if a little
    slowly. I don't actually have an 8.1.x
    database up right now and it will take some
    time. But I think I see what the problem might
    be. I made a change to the image.
    What I did was use a utility to make the
    image "striped". The images were contained
    in one large "chunk" of pixels. TIFF images
    can also be striped, where the pixels are in
    much smaller chunks which means less
    memory is required to work with them. In the
    case of the 8.1.5 image code, there might be
    some spot where it can't handle this kind of
    TIFF image larger than 64k. By causing the
    images to be written with small chunks of
    data you can avoid this. The TIFF manual
    suggests that the chunks be about 8k; for
    this image that translates into about 500
    scanlines per chunk.
    <HR></BLOCKQUOTE>
    John tested this "striped" tiff image and
    successfully uploaded into the database.
    null

  • Image Link Problem with Dreamweaver CS4?

    On my website, I have several images that link to other parts on my website. These work no problem when I preview the site, but after I test the links, the images that had those links have purple outlines that really clash with my website's design. Will users see this if they click on my links, and then return to the page? I'm using CS4 right now, and never recalled having this issue come up when using MX. Thanks for the help.

    I got stuck on this one too - not realising that Dreamweaver automatically palces a border on every image link - but the simplest way I found was to have my "Properties" panel showing on the bottom and input 0 into the "Border" box. By having this panel open you can see if you have accidently applied any styles to the image, where it links to, Image size attributes and the Image name.

  • Importing from Eudora problems - html messages being displayed in plain text and problems with attachments

    Hello,
    I hope you can help me. I've imported all my emails from Eudora into Outlook 2010 but I have a couple of problems.
    All emails that I've imported which had attachments with them have a notice on them saying the attachment has been blocked. I can always browse to the folder whereb my old attachments are stored, but this is still inconvenient.
    Secondly, all my messages that I've sent in the past (html) are being displayed in plain text, which is making them difficult to read because of all the html tags being displayed.
    Also with emails that I've sent in the past- there is no record of any attachments being sent with messages which I know had attachments with them.
    Any ideas? I've trawled google and had no luck except finding programs that cost $70 that can import everything properly.
    David

    David:
    I know this is a very old thread, but did you every figure out a way to fix the formatting of imported Eudora mail?
    I just "upgraded" from Eudora to Outlook 2010 ...
    and have 10 years worth of HTML formatted e-mail that now shows up as plain text with embedded html formatting ...
    apparently it is a long-running problem that has roots in the way Eudora formats messages ...
    Outlook and other e-mail clients all seems to have issues with importing and do not properly recognize HTML-formatted messages from Eudora ... very sad that I can no longer really "read" my old e-mail at this point ...  :-(
    See closing paragraphs here:   http://its.uiowa.edu/support/article/2800
    Same problem over at Mozilla going back 10+ years ... not sure if they fixed it..........
    https://bugzilla.mozilla.org/show_bug.cgi?id=3157

Maybe you are looking for

  • J2ee Add-in - Error on J2ee startup

    Hi We are installing SAP WEBAS NW04 on AIX 5.2 server/Oracle 9.2.0.4 database. We finished ABAP installation and continue to install Java Add-in but we got some errors bellow when J2ee re-started: SAP J2EE Engine Version 6.30   PatchLevel 66061.37 is

  • Osmf Flash Player will not display images in safari and chrome

    In OSMF player, I am using  image to display as thumbnail before playing video. Image is displaying properly in IE and Firefox but I am getting error in safari and chrome. Error of flash player: ArgumentError: Invalid parameter passed to method     a

  • Java client for MQSeries

    Hi , I am new to MQSeries . We have a requirement to develop java wrapper_ to consume /produce message to MQSeries queueies . I googled out for document but no luck i couldnt get proper document . Please help me on this appreciate your help. Thanks &

  • BIOS changed / PC won't start anymore!!

    I have bought a MSI 875P NEO-LSR mobo with an Intel 3Ghz. Everthing was working fine until I encountered problems with Cubase VST software. So I have tried many things to solve the problem of the CPU performance that jumped to 100% when I used only 2

  • On which of the database

    Hi Team, One my team member has provide some permissions to user on few database of an instance. I need to find which are the permissions have been provided on all the databases of an instance. I need the customized script to find this and also that