Problems with image loading

is there any way to load an image to a Frame(not using applet).

Yes, which way would you prefer?
Swing has a component for showing images, ImageIcon.
The Toolkit class of AWT has getImage methods that you can use to load GIF, JPEG and PNG images. See the docs/tutorial for specifics.
If you have images of other file types, check out the new ImageIO API.

Similar Messages

  • Problems with image loader 'swissarmy.js' in 7.0.1

    My Javascript image loader 'swissarmy.js' at www.sustainableaggregates.com loads images right justified in 7.0.1, in older versions of Firefox or all other current browsers it's OK.
    Is this a bug in Firefox 7.0.1 rendering engine or is it down to a bad piece of Javascript. Swissarmy.js is used a lot in many websites.
    Will a future imminent FF upgrade cure this or do I need to source a new image loader script?

    My Javascript image loader 'swissarmy.js' at www.sustainableaggregates.com loads images right justified in 7.0.1, in older versions of Firefox or all other current browsers it's OK.
    Is this a bug in Firefox 7.0.1 rendering engine or is it down to a bad piece of Javascript. Swissarmy.js is used a lot in many websites.
    Will a future imminent FF upgrade cure this or do I need to source a new image loader script?

  • Problem with Image Loading

    Hi,
    I am using JWS to launch my application. Earlier I was using jdk1.5.0_12 version and everything was working fine. But, one of our machines didnt had jdk1.5.0_12 but had jdk1.5.0_19 version. So, JWS uses "Java Web Start 1.5.0_19" version.
    In my code, I am loading images at two different places. At first place I am loading my images using ClassLoader cl = Thread.currentThread().getContextClassLoader();
    InputStream baseInputStream = cl.getResourceAsStream(value);
              if(baseInputStream != null){
                  ByteArrayOutputStream out = new ByteArrayOutputStream(1024);
                  byte[] buffer = new byte[1024];
                  int len;
                  while((len = baseInputStream.read(buffer)) >= 0)
                      out.write(buffer, 0, len);
                  baseInputStream.close();
                  out.close();
                  imageIcon = new ImageIcon(out.toByteArray());
              }This is working fine. But at the second place, I am setting the look and feel for my application using, SkinLookandFeel.loadDefaultThemePack() method. This method hangs permanently and my application fails to launch. When I debugged this method, I found the following:
    1. It goes to loadDefaultThemePack() method of SkinLookAndFeel class. (package: com.l2fprod.gui.plaf.skin)
    2. This in turn calls the loadThemePackDefinition((com.l2fprod.gui.plaf.skin.SkinLookAndFeel.class).getResource("/skinlf-themepack.xml")); of SkinLookAndFeel class.
    3. The XML file is loaded properly.
    4. In method loadThemePackDefinition(), the XML is parsed.
    5. This XML has a tag <icon name="InternalFrame.icon" value="icons/Window.gif" />.
    6. A URL is formed using URL iconURL = new URL(url, element.getProperty("VALUE"));7. This URL is also formed properly.
    8. Next, SkinUtils.loadImage(iconURL) is called.
    9. In this method, image is created using method: byte data[] = SkinLookAndFeel.getURLContent(url);
                img = Toolkit.getDefaultToolkit().createImage(data);10. The img variable created here has width and height = -1 with imagerep (consumer) as null, source (producer) as sun.awt.image.ByteAraryImageSource.
    11. Then, ImageUtils.transparent(img) method is called.
    12. In this method, toBufferedImage(image) method is clalled.
    13. in toBufferedImage(image) method, new image is created using image = (new ImageIcon(image)).getImage(); method.
    14. This new image created also has width and height = -1 with imagerep (consumer) as sun.awt.image.ImageRepresentation, source (producer) as ByteAraryImageSource.
    15. Now, new BufferedImage is created using BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), 2);16. In the constructor of BufferedImage, createCompatibleWritableRaster(width, height) method is called on DirectColorModel. This method throws exception, since width and height are -1.
    Points to note are:
    1. This is working fine with jdk1.5.0_12 but not with jdk1.5.0_19. I tried this with latest java 1.5 version, jdk1.5.0_21. The problem is still there.
    2. When I tried with jdk1.5.0_12, instead of DirectColorModel instance, createCompatibleWritableRaster() method in point 16 above was called on IndexColorModel. I am not creating or initializing any color model, so, I dont know, when does the instance of DirectColorModel or IndexColorModel is used and whether it has any thing to do with my problem.
    Can any one provide any pointers, what could be the issue with jdk1.5.0_19.

    Have a look throughout the forum (and google), JWS retrieved url syntax changed in 5u16 (or 14 I can never remember).
    Otherwise keep waiting for some good samaritan, good luck with it, most people are sick tired of this topic.
    Bye.

  • Problem with image loading in flex (with web dynpro ABAP integration)

    Hi,
    I am working with integration of flex and web dynpro abap. I am facing unusal problem while loading the images. I have the images in the MIME folder of web dynpro application. Since my swf file and all the images that I want to use are in the same folder(MIME), I am accessing them giving just the image name as source for the image in flex.
    By this method I get the images sometimes, but not everytime. So could anyone suggest me alternative method.
    Regards
    Prashant Chauhan
    Edited by: Prashant8809 on Jul 17, 2011 11:56 AM

    Hello Prashant,
    you need to mention the full path as source for the image in flex.
    ex. if your WD application name is Z_TEMP and image file name in mime folder is 'image.jpg' then you need mention the source in flex as
    http://servername:50001/sap/bc/webdynpro/sap/Z_TEMP/image.jpg
    Hope this solves your problem.
    BR, Saravanan

  • Problem with Image loading when using ajax request

    Hi,
    I am uisng "https://ajax4jsf.dev.java.net/ajax" for ajax in my JSF
    and my JSP is:
    <a:outputPanel id="newsPanel">
    <div id="newsImage" class="myclass">
    <h:graphicImage id="img" url="#{mgr.path}" rendered ="#{(mgr.path != null)}"/>
    </div>
    <div class="myclass">
    <a:commandLink id ="update" action="#{mgr.image}" reRender="newsPanel">
    <h:graphicImage id="prevbtn" value="../assets/arrow_small_left.gif" />
    </a:commandLink>
    more stories
    <img src="../assets/arrow_small_right.gif" align="absmiddle" />
    </div>
    <div class="myclass">
    <h2>USA</h2>
    <div class="newsContent">abc.</div>
    </div>
    </a:outputPanel>
    mgr is alias name of my backing bean
    **my backing bean is:**
    public class LoginManager {
    private String path="D:/images/xyz.jpg";
    private String imgPath;
    public String getPath() {
              return path;
    public void setPath(String path) {
              this.path = path;
         public String getImgPath() {
              return imgPath;
         public void setImgPath(String imgPath) {
              this.imgPath=imgPath;
         public void image(){
              setImgPath("D:/images/abc.gif");
    First time image is loading properly.When i click on Previous button previous image is not loading and in console it is showing warning as
    Jun 5, 2008 9:29:55 AM com.sun.faces.taglib.jsf_core.ViewTag doStartTag
    WARNING: "JSF1062: WARNING! The response object returned by ExternalContext.getResponse() doesn't provide a method with signature 'public void flushContentToWrappedResponse()'. This method is necessary in order to provide content interweaving in a JSP environment. Because of this, content will not be displayed correctly.
    What might be the problem.
    Please help me out ASAP...
    Thanks in Advance,
    Narvish

    Have a look throughout the forum (and google), JWS retrieved url syntax changed in 5u16 (or 14 I can never remember).
    Otherwise keep waiting for some good samaritan, good luck with it, most people are sick tired of this topic.
    Bye.

  • Experiencing problem with image display in LR5

    I have an intermittent problem with images displaying and exporting in LR. It just began a couple of months ago and is totally random - will do it with RAW (CR2) or JPG. It displays this way in all modules - Library, Develop, Slideshow....The image displays fine in a non-Adobe image viewer (Faststone or Windows Viewer). I've reloaded LR5 and PSCC and is still persists. I know the image file is fine. It also has begun effecting older images that were showing up just fine a while ago. I just loaded about 200 images and maybe 3 or so have this viewing problem in LR & PS. Has anyone else experienced it and have a suggested fix? My graphics card has the latest drivers and shows no problems with other applications. Here is the same image - one a jpg export from Lighroom, the other a save as jpg from Faststone. HELP!

    This is almost always a hardware problem, causing corruption of the file. The difference you see between Lightroom and other software is that Lightroom is accessing the full RAW image, while the other software is trying to read the embedded JPG preview.
    To figure out exactly what hardware is the problem, you need to try different transmission paths and hardware ... different camera cards, different card readers or USB cables/USB ports, different hard disks, etc. Eventually you should be able to isolate the problem.

  • Problem with Image file

    Hi,
    Iam facing with one problem.I have one swing interface through which I can upload files(back end servlet programme).Now I can upload all types of file but problem with image file it uploading perfectly that means size of the uploaded file is ok but its format damaged.It can not be open.My backend servlet programme is ok coz i tested it with html form it is working perfectly.Problem with swing interface.Plz guide me where I done a mistake.Below r my codes:-
    ImageIcon Upload=new ImageIcon("images/Upload.gif");
         Button=new JButton(Upload);
         Button.setToolTipText("Upload");
    Button.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
              int returnVal = fc.showOpenDialog(ActionDemo4.this);
              if (returnVal == JFileChooser.APPROVE_OPTION) {
              File file = fc.getSelectedFile();
    String aa=file.getAbsolutePath();
              textArea3.append(aa);
                   textArea2.append("Local URL:");
    long l=file.length();
              try
              byte buff[]=new byte[(int)file.length()];
              InputStream fileIn=new FileInputStream(aa);
              int i=fileIn.read(buff);
              String conffile=new String(buff);
              String str1=textArea10.getText();
    url = new URL ("http://127.0.0.1:7001/servletUpload?x="+str1);
         urlConn = url.openConnection();
         urlConn.setDoInput (true);
         urlConn.setDoOutput (true);
         urlConn.setUseCaches (false);
         urlConn.setRequestProperty("Content-Type","multipart/form-data;boundry=-----------------------------7d11e410e500f2");
         printout = new DataOutputStream (urlConn.getOutputStream ());
    String content ="-----------------------------7d11e410e500f2\r\n"+"Content-Disposition: form-data;"+"name=\"upload\"; filename=\""+aa+"\"\r\n"+"Content-Type: application/octet-strem\r\n\r\n\r\n"+conffile+"-----------------------------7d11e410e500f2--\r\n";
    printout.writeBytes(content);
    printout.flush ();
    printout.close ();
    Best Regards
    Bikash

    The errors are here:
              byte buff[]=new byte[(int)file.length()];
              InputStream fileIn=new FileInputStream(aa);
              int i=fileIn.read(buff);
              String conffile=new String(buff); (conffile is a String object containing the image)
    and here:
    String content ="-----------------------------7d11e410e500f2\r\n"+"Con
    ent-Disposition: form-data;"+"name=\"upload\";
    filename=\""+aa+"\"\r\n"+"Content-Type:
    application/octet-strem\r\n\r\n\r\n"+conffile+"--------
    --------------------7d11e410e500f2--\r\n";
    printout.writeBytes(content);conffie is sent to the server but
    it's non possible to treat binary data as String!
    Image files must be sent as byte[] NOT as String ......

  • Problem with images opened in Photoshop CS 5

    Hi, I have a problem with images that I open in Photoshop CS 5. F. ex. I opened
    the following image:
    The image appears with a purple color in Photoshop. If I hover over the image
    with a tool like lasso, it temporarily regains it´s original color. The image mode is RGB Color, 8 Bits/Channel.
    I resetted the start settings of Photoshop with the CTRL-Shift-Alt-combination, which had no effect.

    The confusion arises from the imprecise error message in the Preferences > Performance dialog box, to wit:
    OK, that seems to be open to misunderstanding indeed.
    The video card: Citrix Systems Inc. Display Driver.
    Could not find a list for CS6 specifically, but the card may fall short.
    http://helpx.adobe.com/photoshop/kb/tested-video-cards-photoshop-cs5.html
    If I invoke View > Proof Colors, the only thing that changes is that the text in the brackets
    Also if you set View > Proof Setup to something different?
    Boilerplate-text:
    Are Photoshop and OS fully updated and have you performed the usual trouble-shooting routines (trashing prefs by keeping command-alt-shift/ctrl-alt-shift pressed while starting Photoshop, 3rd party plug-ins deactivation, system maintenance, cleaning caches, font validation, etc.)?

  • Problem with image url

    Hello,
    today I have a problem with image url. I wanted Image to change when mouse dragged over it. But nothing happened. Any ideas?
    def maxIco: ImageView = ImageView{
    image: Image{
    url: "{__DIR__}ikony/max.png"
    onMouseDragged: function(event: MouseEvent){
    maxIco.image = Image{
    url: "{__DIR__}ikony/max2.png"
    }

    This is working for me:
    src/main/Main.fx
    src/main/icon/image1.bmp
    src/main/icon/image2.bmp
    //Main.fx
    package main;
    import javafx.stage.Stage;
    import javafx.scene.Scene;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.input.MouseEvent;
    var changed = false;
    def imgView: ImageView = ImageView {
        image: Image {
            url: "{__DIR__}icon/image1.bmp"
        onMouseDragged: function (e: MouseEvent): Void {
            if (not changed) {
                imgView.image = Image {
                    url: "{__DIR__}icon/image2.bmp"
                changed = true;
                println(imgView.image.url);
        onMouseReleased: function (e: MouseEvent): Void {
            imgView.image = Image {
                url: "{__DIR__}icon/image1.bmp"
            changed = false;
            println(imgView.image.url);
    Stage {
        title: "ImageTest"
        scene: Scene {
            width: 700
            height: 600
            content: [
                imgView
    }I've changed few things to switch image only one time on mouseDragged event.
    It print the image URL.

  • Problem with Image.createImage()

    Hi all!
    I'm writing a simple midlet just to display an image on the screen and I'm having some problems with Image.createImage()
    Here is my code
    Image bg_img;
    ImageItem imageItem1;
    imageItem1 = new ImageItem("", null,ImageItem.LAYOUT_DEFAULT, "");
    try{
    bg_img = Image.createImage("/image.png");
    imageItem1.setImage(bg_img);
    catch(java.io.IOException e){
    e.printStackTrace();
    I'm getting an exception on bg_img = Image.createImage("/image.png");
    I can't understand what is it...:(
    I know for sure that the problem is not "file not found"
    Any one can help me???

    If you are catching IOException, then u may have problem with ur image path. "image not found on the specified path." if ur image is not in the current directiry then put it into current directory. otherwise, If u are using resouce folder and it is already included into the resouce path, then put ur image in that folder..try this..
    Still not get, then please give some detail about ur development toolkit. and ur apllication packaging scheem. are you using ANT?
    Pranav

  • Problem with image gallery

    Hi to all.
    With ios 5.01 I have a little problem with image gallery. As you can see I have only 1 image, but there is always this **** message "download 0 of 46) (sorry, but I'm Italian )
    I've removed my icloud account from settings, but there is nothing to do, this message don't goes away. What I can do? Thanks in advance

    Hello,
    Just adding a gallery I want to do the same slideshow WoodWing's, but in InDesign, if anyone knows of?
    Thank you
    Link video slideshow WoodWing's: http://www.youtube.com/watch?v=Xt6gNaEZ0-M&feature=relmfu
    The first slideshow shown

  • Problems with image scaling

    I'm facing a real problem with image scaling
    I've used several algorithms but it all has defects but the most common thing is the out of memory error after several enlargments...
    does any one know a solution...
    note:
    I've used several packages to do so,but I'm looking for a solution from the jdk itself
    JAlexscorpio

    Did you take into account that the getScaledInstance() -method creates a completly new Image?
    So if you use it like in
    ImageIcon icon1=new ImageIcon("Blah.gif");
    ImageIcon icon2=new ImageIcon(icon1.getImage().getScaledInstance(400,400,SCALE_FAST);
    you will end up with 2 different Images which have their own data and memory requirements.
    even if you use something like
    ImageIcon icon1=new ImageIcon("Blah.gif");
    Image i=icon1.getImage();
    icon1.setImage(i.getScaledInstance(200,200,SCALE_FAST));
    You will need enough memory to store the data for the original image, as well as the data for the scaled
    version of the image, at least for the time that it take the JRE to create the scaled version. You never know when the garbage collector kicks in to delete you old data so it could be that this takes some time and until
    that moment your memory is not available. If your now doing several of the scaling operations, and there is no chance for the garbage collector to do its work, you will run out of memory.
    I hope that might help, if not feel free to post again

  • Problems with Image Variants

    I got two problems with Image Variants:
    1. catalogCache.GetImagePath("Images", id) doesn’t work for some id. The error message is “GetImageVariant error”.
    2. catalogCache.Preload("Images", “Original”)
        catalogCache.Preload("Images", “Thumbnails”)
        catalogCache.Preload("Images", null)
       catalogCache.Preload("Images", "")
    get failed, the status code is -2147483647
    Anyone know how to setup  image variants?
    Thanks.
    Forrest

    status code: -2147483647 is RC_BADPARAM.

  • Copy and Paste Problems with Images

    I'm having the strangest problems with images. I copy an image off of the web for one of my art history classes and I go to paste into another program but, whether it's Keynote, Powerpoint, Photoshop, or Graphic Converter, something always goes wrong: the images definitely lose some of their quality, become brighter in appearance, and get jagged on the edges. This is starting to drive me nuts, especially since it never happened in 10.4 on my iBook G4. Any suggestions?

    Make it an 8-bit file (Image menu > mode).

  • Problems with Safari Loading Sites and Photos

    For the past week (Feb. 2015) I've experience problems with Safari loading websites on my 2009 20" iMac desktop. Running version OSX Lion 10.7.3  4 GB.   Intel Duo Core 2.66 GHz
    Mac also will frequently not upload photos at websites like Yahoo News or Facebook.   It does this throughout the day.
    So, I downloaded Chrome, thinking it would be a better browser if Safari is not functioning.  Chrome is just slightly better, and when it won't load a website I get the following error message from Chrome: DNS_PROBE_FINISHED_NO_INTERNET.
    I'm debating taking the Mac to the Apple store for diagnosis or repair today, but if anyone else is experiencing similar problems, could you please offer some solutions as to what is going on.
    Thank you.
    AngieRK

    Non-responsive DNS server or invalid DNS configuration can cause long delay before webpages load - Apple Support
    Unless you have a good reason not to, you should update the OS to version 10.7.5.

Maybe you are looking for

  • I keep getting the error box "firefox.exe- entry point not found" it says- ?alloc@nsmemory@@sapaxi@z could not be located in the dynamic link library xpcom.dll.

    This happens on more than just the Denver post Broncos site but I notice it there most. When I get the error it locks the page load until I click the OK in the error box. This will happen multiple times as pages load. It started when I upgraded Firef

  • CAD Emails out of sync

    I've got a strange issue with Agent Email and Cisco Desktop Agent, basically the Agent Desktop software seems to be out of sync with Exchange and Supervisor Desktop Both exchange and Supervisor Desktop are showing emails that go back to the 24th, how

  • Connecting to database in a thread class

    HI, I am have a problem when trying to get a conneciton to a database. I am trying to create the connection in a class that extends Thread. Everythign else is set up correctly, i have ran the same code from the main class of my project and it works f

  • Nokia Software Updater - Error 1720

    Hi, I would be very grateful if anyone could help with the following problem: I have downloaded Nokia PC Suite - this works fine.. When I try to download Nokia Software Updater, I receive the following error: "Error 1720: There is a problem with this

  • WAR Deployment Issue

    Hi All, The Application which is built on web services, EJB3.0, Toplinks Essential . When i deploying this application on WebLogic Application Server 10.3 everything works fine. But while Running the same application after deploying in WAR format giv