Load dynamically an image

Hi,
          I have been trying to load dynamically an image using WLS 6.0, but I
          failed. To simplify the case, following is just a simply scenario.
          All images are stored under the directory doc_root/images. When the WLS
          server is on, I enter the URL: http://localhost:8080/images/image.gif.
          If this image file exists, it is printed in the browser, it is correct.
          But when I copy a new image file (I mean at the moment when the server
          is launched, the file is not under the directory /images) say test.gif
          from other place, and then I input the
          URL:http://localhost:8080/images/test.gif. No image is printed, but for
          the moment this file is saved under the /images directory. Only when I
          shut down the server and relaunch it and type the previous URL, this
          image can be printed. I did the same test using Tomcat3.2, it worked. So
          I guess it is a bug of WLS6.0
          Our project needs to load images dynamically, we cannot shut down the
          server whenever a new image is uploaded, but we need new images can be
          printed in real time.
          Did anybody meet the same problem and is there any work around? Thanks
          in advance
          [att1.html]
          

Sonia,
          On our development evironment (where we use open directory
          deployment) it works for me.
          We are using wls6.0sp1.
          Thanks,
          Kumar.
          Sonia WEN wrote:
          > Hi,
          > I have been trying to load dynamically an image using WLS 6.0, but I
          > failed. To simplify the case, following is just a simply scenario.
          >
          > All images are stored under the directory doc_root/images. When the
          > WLS server is on, I enter the URL:
          > http://localhost:8080/images/image.gif. If this image file exists, it
          > is printed in the browser, it is correct. But when I copy a new image
          > file (I mean at the moment when the server is launched, the file is
          > not under the directory /images) say test.gif from other place, and
          > then I input the URL:http://localhost:8080/images/test.gif. No image
          > is printed, but for the moment this file is saved under the /images
          > directory. Only when I shut down the server and relaunch it and type
          > the previous URL, this image can be printed. I did the same test using
          > Tomcat3.2, it worked. So I guess it is a bug of WLS6.0
          >
          > Our project needs to load images dynamically, we cannot shut down the
          > server whenever a new image is uploaded, but we need new images can
          > be printed in real time.
          >
          > Did anybody meet the same problem and is there any work around? Thanks
          > in advance
          [att1.html]
          

Similar Messages

  • Loading dynamically a Image

    Post Author: Fabio
    CA Forum: General
    Is there a way to load a image dynamically? For example, depending on the Theme of my application or the .css.

    Post Author: Manuel de Kleine
    CA Forum: General
    Fabio,Actually, you can, but only if using the image name.So, if you want to show a photo of an employee with his/her details, you could state the image with that details should be .jpg.To do this, you should insert a placeholding image. In the properties for this image, you can enter the location of the image on the tab [Image]. In the formula you could enter:.\images\.jpg.

  • Button to load dynamic image in interactive form webdynpro for java

    Hi all
    i tried to use image field to load dynamic image as shown in the online interactive form tutorial
    and it worked for test but when try it with view appears inside viewset it doesnt....
    so i think if we could call the image after render by pressing a button inside the form it may work
    but the problem is i have no idea about how to implement such solution ,so if any one has any idea about how to implement such solution i will be thankful if he can share me the solution.
    thanks.....
    Naguib..

    use the following tutorial. it is very easy to follow and it works fine, i have tried that.
    http://www.docstoc.com/docs/2540673/How-To-Integrate-ADOBE-form-on-WebdynPro-for-ABAP-and-Deploy-it-
    in case of some more problems, ask again and point out the part of tutorial where there is a problem.

  • Loading a specific image using servlets

    Hello,
    I have a question regarding a servlet and my HTML. In my HTML page I should load/ reaload some GIF images that are being dynamically created on the serves: drawn with Java 2 D and afterwards GIF encoded. response.setContentType("image/gif");
    GifEncoder encoder = new GifEncoder(img, out);
    in the servlet GraphicServlet.java, for example.
    In my HTML page I want to load this image that is being formed on the server. Here's that piece of code:
    <td><A HREF="http://localhost:8080/servlet/mypackage.myServlet?Nothing! onMouseover="ddrivetip('Click to draw a selected shape', 'yellow', 250)";
    onMouseout="hideddrivetip()">
    <img WIDTH=375 HEIGHT=250 BORDER=0 src="<%
    if (request.getParameter("string")!=null)
    out.print((String)request.getParameter("string"));
    else
    out.print("http://localhost:8080/servlet/mypackage.GraficServlet?undo");
    %>" ISMAP/></a></td>
    The thing is that I want to load in HTML page in a table the image splitted on the the server. Every cell of the table is a part of the image. My question is how I can do that? Assign an id to every part and load that? What parameted should I pass between the HTML page and the server in order to be able to do that? How can I do in order to be able to reload in the browser only that piece of image that suffered modifications?
    Thank you in advance.
    Dani

    Hello,
    I will try to explain in a better way.
    At the present moment the application behaves as it follows:
    1.The Server creates the image and encodes it into GIF
    2. Html displays this image as a server side image map
    3. The image is dynamically umpated in the browser, being modified by user interactions, and modifications are sent to the server
    4. On the server I am splitting this image in subimages (for example, a grid of 4 equal tiles)
    What I'm indending to do is:
    1. What I am trying to do is display in a table in the browser the subimages, each cell holding one part of the entire image, and I don't know what parameter I should use and how, as a selection of the sub-image.
    Here's the fragment where I am loading the entire image in the browser. I don't know how I should modify that in order to be able to load the certain parts on the original images in a table, in my HTML page.
    <td><img WIDTH=375 HEIGHT=250 BORDER=0 src="<%
    if (request.getParameter("string")!=null)
    out.print((String)request.getParameter("string"));
    else
    out.print("http://localhost:8080/servlet/mypackage.GraficServlet?undo");
    %>" ISMAP/></td>
    Thank you, once again.

  • Loading the same image multiple times

    I'm trying to dynamically load a single image multiple times
    into flash. Basically I want to end up with two movieclips mc1 and
    mc2 that contain the image. I'm currently using the Loader
    component (connected to the ProgressBar) to dynamically load the
    image. It works fine for loading the image once but I'm really not
    sure how to go about creating a second movie clip with the image.
    Here's my code for loading the first image:
    var mc1:MovieClip = new MovieClip();
    var listener:Object = new Object();
    listener.complete = function(eventObj:Object){
    nextFrame();
    imageLoader.addEventListener("complete", listener);
    mc1 = imageLoader.content;
    imageLoader.load(imgURL);
    But everything I've tried to load mc2 with that same image
    has failed. I've tried 'mc2 = imageLoader.content', 'mc2 = mc1',
    'attachMovie', 'duplicateMovieClip', calling imageLoader.load()
    twice on the imgURL, and creating a second Loader component and
    loading the image again. All of these methods have invariably
    failed. Most of them can load mc1 alright and sometimes mc2 even
    shows up on the stage but in the AS mc2 is always undefined.
    Can anybody point me in the right direction for loading
    multiple copies of the same image? It really shouldn't be that
    hard, should it?

    Well I figured out a solution. Turns out Flash doesn't allow
    you to duplicate dynamically loaded content like an image in a
    movieclip. But there is a little class called BitmapData that will
    do precisely what I was looking for. Here's the link I got this
    info from:
    http://www.senocular.com/flash/source.php?id=0.174

  • How to load a tif image in flex

    Hi All,
    Is it possible to load a tif image in flex. If it's possible
    anyone guide me or send me some code snippets regarding how to
    display a tif image in flex.
    Regards,
    Dharma

    "flexdharma" <[email protected]> wrote in
    message
    news:ga2d96$p8h$[email protected]..
    >
    Hi All,
    > Is it possible to load a tif image in flex. If it's
    possible anyone guide
    > me or send me some code snippets regarding how to
    display a tif image in
    > flex.
    Convert it to the much more web-friendly png format.

  • Sybase gateway problem - Failed to load dynamic library 'hsdbsyb'

    Having problems getting the Sybase gateway working on XP. Environment in Oracle 9.2.0.6 on Linux, Sybase on AIX 5.1 (moving to linux, gateway currently working well on this box) gateway on XP. I get the following error when trying to use my db link: Help appreciated
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [Transparent gateway for SYBASE]DRV_InitTdp: DBTYPE.C (473): ; The specified module could not be found.
    ; at FIND_IMAGE_SYMBOL
    DBTYPE.C (7): ; [C079] Failed to load dynamic library 'hsdbsyb'
    tnsnames on linux box has:
    CIT001TSTW =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = tcp)(HOST = lons00106694)(PORT = 1521))
    (CONNECT_DATA =
    (SID = cit001tst)
    (HS = OK)
    on gateway windows box (has oracle client and gateway software and sybase client)
    listener.ora:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = c:\progra~1\oracle)
    (PROGRAM = extproc)
    (SID_DESC=
    (SID_NAME = cit001tst)
    (ORACLE_HOME = c:\progra~1\oracle)
    (PROGRAM = tg4sybs)
    initcit001tst.ora
    HS_FDS_CONNECT_INFO=CIT1_LON_TST_SQL.cit001tst
    HS_FDS_TRACE_LEVEL=ON
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVER
    HS_FDS_TRACE_LEVEL=4
    HS_FDS_FILE_NAME=trace
    # Environment variables required for Sybase
    set SYBASE=c:\progra~1\sybase\oc1251
    sql.ini
    [CIT1_LON_TST_SQL]
    win3_query=WNLWNSCK,loncmxs0004.uk.net.intra.,5000
    query=NLWNSCK,loncmxs0004.uk.net.intra.,5000

    Yes, this VI is damaged. I can not open it.
    Colin
    LV7.1/8.2/8.2.1/8.5/8.6/9.0/2010/2013; testing system development
    Please Mark the solution as accepted if your problem is solved and donate kudoes
    Home--www.colinzhang.net

  • Unable to load dynamic library oci8.so

    Hello All,
    When I try to start lampp, I am getting the below error.
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0
    But I have  libclntsh.so.11.1 in my system. Why it is searching for libclntsh.so.10.1?

    Madhu.149 wrote:
    Hello All,
    When I try to start lampp, I am getting the below error.
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0
    But I have  libclntsh.so.11.1 in my system. Why it is searching for libclntsh.so.10.1?
    Madhu.149 wrote:
    Hello All,
    When I try to start lampp, I am getting the below error.
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0
    But I have  libclntsh.so.11.1 in my system. Why it is searching for libclntsh.so.10.1?
    >Why it is searching for libclntsh.so.10.1?
    old PHP software that does not know about V11
    So just create a softlink as below
    ln -s libclntsh.so.11.1 libclntsh.so.10.1

  • How to load a boot image to cisco aironet 1140 series after missing boot image

    Hi all,
    I need a solution for this. When i switch my cisco aironet 1140 , it s blinking with red light .and gives a message "no boot image to load".
    When i tried next time, by pressing escape it shows this message that i have mentioned below.
    ap:
    ap:
    using  eeprom values
    WRDTR,CLKTR: 0x83000800 0x40000000
    RQDC ,RFDC : 0x80000035 0x00000208
    using ÿÿÿÿ ddr static values from serial eeprom
    ddr init done
    Running Normal Memtest...
    Passed.
    IOS Bootloader - Starting system.
    FLASH CHIP:  Numonyx P33
    Checking for Over Erased blocks
    Xmodem file system is available.
    DDR values used from system serial eeprom.
    WRDTR,CLKTR: 0x83000800, 0x40000000
    RQDC, RFDC : 0x80000035, 0x00000208
    PCIE0: link is up.
    PCIE0: VC0 is active
    PCIE1: link is NOT up.
    PCIE1 port 1 not initialized
    PCIEx: initialization done
    flashfs[0]: 1 files, 1 directories
    flashfs[0]: 0 orphaned files, 0 orphaned directories
    flashfs[0]: Total bytes: 32385024
    flashfs[0]: Bytes used: 1536
    flashfs[0]: Bytes available: 32383488
    flashfs[0]: flashfs fsck took 16 seconds.
    Reading cookie from system serial eeprom...Done
    Base Ethernet MAC address: 28:94:0f:d6:c8:62
    Ethernet speed is 100 Mb - FULL duplex
    The system is unable to boot automatically because there
    are no bootable files.
    C1140 Boot Loader (C1140-BOOT-M) Version 12.4(23c)JA3, RELEASE SOFTWARE (fc1)
    Technical Support: http://www.cisco.com/techsupport
    Compiled Tue 18-Oct-11 14:51 by prod_rel_team
    ap:
    So , now my question is how to load the boot image ? From where will we get this ? OR
    I m also having another Cisco aironet 1140 , Can i get bootimage from that . Kindly let me know the solution from genius ?

    Take a look at this link as it should have the info you need
    https://supportforums.cisco.com/docs/DOC-14636
    Sent from Cisco Technical Support iPhone App

  • How to load a background Image on a JDialog object

    Hi All, Actually i am new to java programing and i am stuck in this problem. I am developing a java application which is dialog based (using JDialog objects) and i want to load a background image on my dialog. I hope this could be done and i really appreciate your help because i must deliver this project and this is a user interface requirement.

    Try something along the lines of this: Create a new class called BackgroundImagePanel and have it extend JPanel.
    Have an attribute in the class for your image, and a method to set it.
    Override isOpaque() to return true.
    Override the paintComponenet method as such:
    public void paintComponent (Graphics g) {
    super.paintComponent(g);
    if( image == null ) return;
    Icon icon = new ImageIcon(image);
    icon.paintIcon(this, g, x, y);
    Add this panel to your JDialog and then add other component to this panel.
    You might have to tweak this a bit, but it should get you close...
    Bill

  • How to load a PNG image from a location in CF card

    Hi,
    I am using WTK 2.5.2. I wanted to load a PNG image to Image object. The image is loaded when I have it in the classes folder. But I want to select different image from a different location. If I try to open an Image to createImage(String) from a different location, I get IOException.
    Please help me.
    Thanks
    Deekshit M

    I got the answer, I should be using Image.createImage(InputStream) API. It works fine.
    Thanks
    DM

  • Error editing task sequence: Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" From XML into WMI

    I've started getting an intermittent error editing my Windows 7 OSD task sequence.  Sometimes I can open the TS to edit, but when I try to apply changes I get the error.  Other times I get the error when trying to open the TS.  If I try again
    right away, I still get the error, but if I wait a few minutes and try again sometimes it will open the TS. 
    The error reads:
    ConfigMgr Error Object:instance of SMS_Extended Status{Description = "Failed to load dynamic properties for class \"SMS_TaskSequence_ApplyWindowsSettingsAction\" from XML into WMI";Error Code = 2147943746;File = "e:\\qfe\\nts\\sms\\siteserver\\sdk_provider\\smsprov\\ssptspackage.cpp";Line = 3454;Operation = "ExecMethod";ParameterInfo = "SMS_TaskSequencePackage";ProviderName = "WinMgmt";StatusCode = 2147749889;}
    Coinciding with this error, I show the following entries in the TaskSequenceProvider.log file: 
    [PID: 7608] Invoking method SMS_TaskSequence.LoadFromXml
    TaskSequenceProvider
    Failed to protect memory buffer, hr=0x80070542
    TaskSequenceProvider
    Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" from XML into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load node Apply Windows Settings from XML into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "PostInstall" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "Execute Task Sequence" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load XML for the task sequence into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    [PID: 7608] Done with method SMS_TaskSequence.LoadFromXml
    TaskSequenceProvider
    Setting status complete:  status code = 0x80070542; Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" from XML into WMI
    TaskSequenceProvider
    I exported the task sequence and checked in "object.xml" for the "ApplyWindowsSettingsAction", to see if there was something odd in the xml, but I don't find anything that jumps out as being wrong.  Here's the section of XML for
    that step.  I've removed identifying info, and replaced it with a generic term in bold.
    <step type="SMS_TaskSequence_ApplyWindowsSettingsAction" name="Apply Windows Settings" description="" runIn="WinPE" successCodeList="0" runFromNet="false"><action>osdwinsettings.exe /config</action><defaultVarList><variable name="OSDLocalAdminPassword" property="AdminPassword"></variable><variable name="OSDComputerName" property="ComputerName">%_SMSTSMachineName%</variable><variable name="OSDProductKey" property="ProductKey"></variable><variable name="OSDRandomAdminPassword" property="RandomAdminPassword">false</variable><variable name="OSDRegisteredOrgName" property="RegisteredOrgName">COMPANY NAME</variable><variable name="OSDRegisteredUserName" property="RegisteredUserName">COMPANY NAME</variable><variable name="OSDServerLicenseConnectionLimit" property="ServerLicenseConnectionLimit">5</variable><variable name="OSDTimeZone" property="TimeZone">Central Standard Time</variable></defaultVarList></step><step type="SMS_TaskSequence_ApplyNetworkSettingsAction" name="Apply Network Settings" description="" runIn="WinPEandFullOS" successCodeList="0" runFromNet="false"><action>osdnetsettings.exe configure</action><defaultVarList><variable name="OSDDomainName" property="DomainName">DOMAIN.COM</variable><variable name="OSDJoinPassword" property="DomainPassword"></variable><variable name="OSDJoinAccount" property="DomainUsername">DOMAIN ACCOUNT</variable><variable name="OSDEnableTCPIPFiltering" property="EnableTCPIPFiltering" hidden="true">false</variable><variable name="OSDNetworkJoinType" property="NetworkJoinType">0</variable><variable name="OSDAdapterCount" property="NumAdapters" hidden="true">0</variable></defaultVarList></step>
    Is there any other log I should check for a clue on this issue?  What could be causing this error?

    Thanks for sharing that!  I tend to save contacting MS support until after I've exhausted other options.  I'm always afraid that I'll spend the $500 to open a case and then it turns out to be something simple that I would have found if I had just
    kept working on it myself a little longer.
    It looks like that link is for an update released in February as KB3023562.  I downloaded and installed it. I'll try opening/editing/saving the task sequence a few times today to see if the issue is resolved.  
    After I had already installed it, I thought to look up that update in configmgr.  The update is listed as superseded by 2 other updates.  The newest of those is KB3046049, which just installed last night with the other March patches, so it's possible
    that I didn't need to install KB3023562 after all.  

  • Loading only last image

    This code is loading the xml correctly, populating the mainClipArray correctly, but only adding the last image to the stage.
    I think it is not waiting for completeClipLoad() to complete.  I tried removing :void from the function to see if waiting for a return would do it, but no luck.
    Any ideas?
    CODE:
    var myXML:XML;
    var xmlLoader:URLLoader = new URLLoader();
    var mainClipArray:Array = [];
    var counter:int = 0;
    var myLoader:Loader = new Loader();
    xmlLoader.load(new URLRequest("portfolio.xml"));
    xmlLoader.addEventListener(Event.COMPLETE, completeXMLLoad);
    function completeXMLLoad(e:Event):void{
        myXML = XML(e.target.data);
        var len:int = myXML.portfolio.unit.length();
        for(var i:int = 0; i<len; i++){
            counter = i;
            mainClipArray[i] = new pane();
            //Load small image
            var smallfilename = myXML.portfolio.unit[i].small.filename;
            myLoader.load(new URLRequest(smallfilename));
            myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeClipLoad);
            mainClipArray[i].x = i * 15;
            addChild(mainClipArray[i]);
    function completeClipLoad(e:Event):void{
        trace("made it in");
        mainClipArray[counter].addChild(myLoader);
        trace("added child");

    Delaying the progress isn't going to help if you still have only one loader.  I would say that you could move the var myLoader:Loader = new Loader(); line inside the loop so that you have a new loader instance for each loading occurence, but then you would also need to adjust the completeClipLoad function to use the event target (e.target) instead of "myLoader".  But that still wouldn't resolve matters completely because you have that counter variable that will be working as fast as the for loop, with the loop likely finishing before the first item gets loaded... and since your completeClipLoad also makes use of that variable, you'll end up with only the last pane object being used.
    If you want to control the order of loading and retain the code in the one place (the other suggestion offered above having the code inside the pane could also be a viable approach), then a better strategy is to to use a programmed loop rather than a for loop, where only one loading occurs at a time and the completion of one loading triggers the next to begin.  Something like (this is just an outline form)...
    counter = 0;
    imgArray;
    function completeXMLLoad(e:Event):void{
         ... // process all the xml into the imgAray
        loadSmallImage(); // start by loading the first image only
    function loadSmallImage(){
         // create loader instance
         // assign load complete listener
         // load imgArray[counter]
    function loadComplete(e:Event) {
         // process the loaded image in a new pane
         // increment counter
         // if counter is < imgArray.length -> loadSmallImage();

  • How to dynamically call image  in PDF for Acrobat ver 8.1 onwards?

    Hi Experts,
    I am using Web Dynpro Java. My requirement is to call the images dynamically on a PDF form. There are no of company code. I have to call different logos for different company codes/
    We are now using Acrobat 8.1.1. Please refer following thread.
    http://kb2.adobe.com/cps/405/kb405270.html
    From Acrobat 8.*, we have to use some different method for dynamically calling the images. Earlier we were using the concept mentioned below to dynamically call images.
    However this method is not applicable for Acrobat Reader 8.* onwards due to security reasons.
    Click on the Layout tab and choose None for the Caption position.
    u2022 Click on the Object, then the Binding tab and choose None for Default Binding.
    u2022 Click on the Field tab, enter $record.SapOnlineShopUrl for the URL entry, and select Use Image Size for the Sizing field.
    u2022 Click on the script editor and enter the following FormCalc script statement, which enables the dynamic integration of the image. Show: initialize Script: this.value.image.href = xfa.resolveNode(this.value.image.href).value; Language: FormCalc Run At: Client
    write following code in wddoinit
    try { String url = WDURLGenerator.getAbsoluteWebResourceURL( wdComponentAPI.getDeployableObjectPart(), "sap_online_shop.jpg"); wdContext.currentDataSourceElement().setSapOnlineShopUrl(url); } catch(Exception e) { throw new WDRuntimeException(e); }
    Please let me know what is the alternate method for Adope ver 8.1.1
    Regards,
    Gary

    Hi Gary,
    First you upload the image in SAP through se78.then write the below code in your adobe form interface.
    data :  v_object type  TDOBJECTGR value 'GRAPHICS',
            v_id  type TDIDGR  value 'BMAP',
            v_btype type TDBTYPE value 'BCOL',
            V_FIELD TYPE XSTRING.
    V_NAME = 'ZW_DEVMAN_LOGO'.
    CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
    p_object = v_object " 'GRAPHICS'
    p_name = v_name " Name of the logo as in se78
    p_id = v_id " 'BMAP'
    p_btype = v_btype " 'BCOL' ( whether the image is in color or black and white )
    RECEIVING
    p_bmp = v_field
    EXCEPTIONS
    not_found = 1
    internal_error = 2
    OTHERS = 3.
    g_logo = v_field.
    Declare g_logo as xstring in global data.
    In context of the form make one graphic element with field g_logo and mime type BMP.It will work.
    Regards,
    Simi A M
    Edited by: amsimi on Jan 26, 2011 5:30 AM

  • 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);
    };

Maybe you are looking for