Load image with ImageIcon component

Hello,
I want to load an image whose name or path contains special character such as accents (a french name). So that generates an exception. For exemple for an image named caf�.jpeg I obtain this message :
java.io.FileNotFoundException: /media/disk/images/caf��.jpeg (No such file or directory)
Can you please help me.
Thanks in advance.

hi,
get this sample example and develop
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.ImageIcon;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class ji extends JApplet
public Icon pulicon;
public JButton b1;
    public void init()
        getContentPane().setLayout(null);
        this.setSize(744, 536);
        pulicon = new ImageIcon(getImage(getCodeBase(),"bullet.gif"));
        b1 = new JButton(pulicon);
        getContentPane().add(b1);
        b1.setBounds(50,50,42,42);
//<applet code="ji.class" height="200" width="200"></applet>that gif picture from current dir, where your class file stores.. if u want specify the path there

Similar Messages

  • Loading images with different horizontal sizes

    I would like to load images with different horizontal
    resolutions (vertical resolution to be the same) dymanically into
    an empty movie clip. I would like them to load with the right hand
    side of the image lined up with the right hand side of my site. I
    have seen many tutorials about how to accomplish the loading of the
    movies, but I cannot figure out how to make them open with the
    right hand side always lined up on the right.
    To be more specific, let's say I have three images of the
    varying pixel resolutions (1200x600, 800x600, and 400x600 for
    example). I would like the horizontal size to always extend away
    from the right hand side of the site with the right hand edge of
    the images always lined up.
    Is this possible to do by loading them into an empty movie
    clip?
    thanks

    When you load an image file into an empty movieClip, that
    clip takes on the dimensions of the loaded content. The
    registration point for the clip is set to the upper left corner.
    So, once the new image is loaded, just set that clip's .x to the
    stage width - the width of the clip.

  • Loading images with transitions

    Hi,
    trying to have slideshowish thing, loading images with transitions.
    I have this code for first image, what I need to load next images...?
    import fl.transitions.Tween;
    import fl.transitions.TweenEvent;
    import fl.transitions.easing.*;
    import flash.events.*;
    var curTween:Tween = new Tween(1_mc, "alpha", Strong.easeOut, 100, 0, 3, true);
    curTween.addEventListener(TweenEvent.MOTION_FINISH, fadeBackIn);
    function fadeBackIn(event:TweenEvent) {
         var nxtTween:Tween = new Tween(1_mc, "alpha", Strong.easeIn, 0, 100, 3, true);

    i'm not sure that makes sense.  you're fading out 1_mc and then fading it back in.
    normally you would fade out a previous image and fade in the next image.

  • Loading images with properties in Forms6

    Hello !
    I would like to use Mmix32.ocx with Forms6 to have properties and
    methods of loaded images !
    But I don't know how , cause I imported Ole library interfaces MMix control without results !
    I need an exemple !
    thanks !

    Me too !
    I would like to use Mmix32.ocx with Forms6 to have properties of images !
    I imported Ole library interfaces MMix control !
    I have an error:
    FRM-41344:ole object not defined for <item name> in current record !

  • Load images with some effects

    Hi, I wanted to load java images with some effects like we have in power point like blinds or appear in Java swing when user clicks on the image.
    I have these specific questions in mind:
    1.Is there a way to do this in Java?
    2.Also how will this behave when the image to load is huge like 25 Mega Pixel?
    3.If we are dealing with large images being switched, what mechanism should be used for incorporating images in the application?
    4. Can there be a provision of displaying an image over another one with the one on the top having some transparency?
    Thanks,
    Sandeep

    Kayaman wrote:
    835085 wrote:
    how can this be done? do you have any pointers. i have played with swing earlier but did not know about the effects thingy.Well I didn't mean that you'd have ready made powerpoint-like effects (unless someone has created a library for that kind of stuff). I mean Java is a programming language, Powerpoint is a crime against nature.
    You'd need to program those effects (or find a library that does).OK, i think i will have to try this out first.
    The point is that i wanted to confirm to go with java or choose python.
    I need to track user inputs and display really large images. Now the interaction is really on graphical side like have moving images in the application which are transparent. I know Java but havent played with images yet and was not sure whether it will be worth spending days on this and then switch to python.
    >
    well my scenario will be 2x2 matrix of screens. it will be a 25 MP screen. so wont this work now in this context?Sure, if you have the resolution.
    i was thinking in terms of response time. any inputs?And I was answering in terms of response time. The Fullscreen API. Of course you'll need to keep all the images in memory (or at least a certain range if you want to show them fast enough).
    4. Can there be a provision of displaying an image over another one with the one on the top having some transparency?Sure.any pointers?Well, Java does support transparency and alpha channel. But you'll need to go through the APIs to find ways to do those.
    Is there a reason why you want to do this in Java?I mentioned that I have worked on swing before but was not sure to do it in a totally new prog. language like python.

  • Loading Images with 1.3.1 Problem

    Hi!
    I've got a couple of swing applets that use Images. One uses the images for icons and one just draws the images. The images are loaded from jar files. Using version 1.3.0, everything works fine. When I load the applet using 1.3.1 or 1.4, however, the images do not appear on the screen. According to the Java Console, the images did load. I saw messages like:
    Loaded image: jar:file:/C:/rgajava/MKSLeak/jar/leak.htmlMKSLeak.jar!/images/audiooff.gif
    Loaded image: jar:file:/C:/rgajava/MKSLeak/jar/leak.htmlMKSLeak.jar!/images/audioon.gif
    that were displayed when I upped the trace level. The images still do not appear.
    Does anyone know how to fix this? I am loading the images using getImage(URL,String).
    Thanks,
    Derek

    As a partial answer to my own question, the Java tutorial declares that some browsers cannot load images from jar files. This appears to be the case with IE5.5 and Java 1.3.1, but it is strange that IE5.5 and Java 1.3.0 seem to have no problem. Nevertheless, the applet works well and images load if the images are accessed outside of the jar file.
    Derek

  • Loading image with loadMovie

    I am loading an image to a movie clip (name container) using
    loadMovie but when the image loads the movie clip is resized to the
    size of the loaded image, is there a way to prevent that from
    happening? I want the movie clip to retain its original size.
    Thank you for your help,

    Loaded images or swf's only inherit position, rotation and
    scale. They load
    at their original size though. If you want to resize them to
    fit a
    particular area, you'll need to do that with AS. First you
    will need to stop
    using loadMovie and use the MovieClipLoader class instead.
    You should be
    using it anyway, it's better.
    Simple example that loads an image from my C: drive into a
    clip named 'hold'
    var myLoader = new MovieClipLoader();
    var lis = new Object();
    lis.onLoadInit = function(targ:MovieClip){
    targ._width = 83;
    targ._height = 119;
    myLoader.addListener(lis);
    myLoader.loadClip("c:/dm_phillips_2005.jpg", hold);
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Need help Loading images with selection on a form field?

    So I'm kind of a newb.. I can do basic forms but I need to set up a form field drop down box that will give me the ability to load images correlating to the users choice. I'm at a total loss for where to start, so ANY help would be appreciated. If you know of any good books or tutorials on the subject please share.
    Thanks in advance
    Sincerely,
    Stumped4now 

    P.S. I think I'm getting a better understanding of OCGs after lots of research today. However I still seem to be missing something
    var docOCGs = this.getOCGs();
    for (var x=0; x < docOCGs.length; x++)
      if(docOCGs[x].name == "Layer1")
      docOCGs[x].state = !docOCGs[x].state;

  • Show a .tif image with ImageIcon?

    I'm using ImageIcon class to display images, but I have a tif formatted image. ImageIcon doesn't seem to support it. Is there a work around?

    Use the feedback link?

  • Exception when loading an image in ImageIcon component

    Hello,
    I want to load an image whose name or path contains special character such as accents (a french name). So that generates an exception. For exemple for an image named caf�.jpeg I obtain this message :
    java.io.FileNotFoundException: /media/disk/images/caf��.jpeg (No such file or directory)
    Can you please help me.
    Thanks in advance.

    Can you store multiple images in memory and be able
    to reference them all individually, or is it better
    to store them in a construct, such as an array and
    then loop through that when attempting to match?I'm sorry but I don't understand the question. And does it
    have anything to do with images per se? Can it be generalized
    without losing its meaning:
    Can you store multiple objects in memory and be able
    to reference them all individually, or is it better
    to store them in a construct, such as an array and
    then loop through that when attempting to match?It seems to me that multiple objects should be stored in
    an appropriate collection, if that is what is required.
    Perhaps you need to say more about what you are trying to
    do, what your goal is, to make your question meaningful.

  • Need help displaying images with List component for Flash CS4 (ActionScript 3.0)

    Hi folks:
    I am an inexperienced user of Flash CS4 Pro (v10.0.2). I am attempting to use the List component with ActionScript 3.0 to make a different image display when a user clicks each item in a list.
    I did find a tutorial that showed me how to make different text display using a dynamic text box and the following ActionScript:
    MyList.addEventListener(Event.CHANGE, ShowSelectedItem);
    function ShowSelectedItem(event:Event):void {
        ListText.text=MyList.selectedItem.data;
    ...where My List is the instance of the List component and ListText is the dynamix text box. In this case, the user clicks an item in the list, defined by the label value in the dataProvider parameter of the List component, and text displays as defined in the data value in the dataProvider parameter.
    However, as I mentioned to start, what I really want to do is make images display instead of text. Can anyone provide me the steps to do this?
    I appreciate your help (in advance)!!
    Cindy

    Hi...thanks for responding! I was planning on using images from the Library, but if there is a better way to do it, I'm open. So far, I just have text in the data property. This is part of my problem. I don't know what I need to put in the data value for an image to display. Do I just put the image file name and Flash will know to pull it from the Library? Do I need to place the images on the stage on different frames? I apologize for the "stupid user" questions, but as you can tell, I'm a newbie.
    Appreciate your patience and any help you can offer!
    Cindy

  • Tomcat not loading images with mod_jk

    I have images stored in a database which when retrieved have the extension .tmp when I view these images using tomcat they are recognised as being jpeg or bmp files etc. and are displayed as images.
    When the same images are viewed using tomcat through apache using the mod_jk module, the images appear as text.
    If I try viewing the same images in apache on its own they appear fine. To repeat this, take a jpeg file and change its extension to .tmp place the file in a tomcat application, lookat the image using tomcat on its own //localhost:8080/myapp/myimage.tmp it appears fine, look at it using apache using mod_jk //localhost/myapp/myimage.tmp and it appears as text. Has anyone got any clue as to how to fix this.
    I am using apache 2.0 with mod_jk 1.2.15 and jakarta-tomcat-5.0.28
    Any help would be most appreciated, mod_jk drives me mad!!!. Thanks Mike.

    webmail which i access through safari on my imac and ipad. For the last couple of days images have stopped loading with all my emails
    Try emptying the cache on your iMac and iPad.
    One the iMac with Safari open, press Command + Option + E on the keyboard. Quit and relaunch Safari to test.
    On the iPad. Tap Settings > Safari. Tap Clear History then tap Clear Cookies and Data. Restart your iPad.

  • How to change Images with ImageIcon

    Hello everyone, this is my first post on the forums.
    I am struggling at the moment to find a way to change images in my program. I am making a card game and when the user clicks a button it will replace the card he has with another card. I thought the following code would work but apparently it doesnt:
    String cardPathA = "image1.gif";
    ImageIcon imageCardA = new ImageIcon(cardPathA);   //cardPathA for example is image1.gif
    //during the program the user changes cards so it should now show image2.gif
    cardPathA = "image2.gif";
    imageCardA.setImage(cardPathA);The error occurs when compiling and it reads: "+setImage(java.awt.Image) in javax.swing.ImageIcon cannot be applied to (java.langlString)+".
    I have searched all over the internet and I haven't found anything. I would appreciate some help. Thanks :)

    im not really sure i made a quick example to show how I would change the imageIcon in a button, just change the paths for cardPathA and cardPathB for your pictures to get it working.
    The only other thing i can think of is maybe to call repaint() for the components you are trying to change the image?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class ImageChange extends JFrame implements ActionListener{
             final private String cardPathA;
            final private String cardPathB;
         private ImageIcon myImageIcon;
            private JButton changeCard;
            private int counter;
            private JPanel panel;
            private JButton imageButton;
         public ImageChange(){       
                changeCard = new JButton("Change Button");
                counter = 0;
                cardPathA = "1.gif";
                cardPathB = "2.gif";
                myImageIcon = new ImageIcon(cardPathA);
                imageButton = new JButton(myImageIcon);
            public void makeGui(){
                changeCard.addActionListener(this);
                panel = new JPanel(new BorderLayout());
                panel.add(changeCard,BorderLayout.NORTH);
                panel.add(imageButton,BorderLayout.CENTER);
                this.add(panel);
                this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
                this.pack();
                this.setVisible(true);
         public void actionPerformed (ActionEvent menuChoice){
                counter++;
                if(counter%2 ==0){             
                    myImageIcon = new ImageIcon(cardPathA);
                    imageButton.setIcon(myImageIcon);
                }else{
                    myImageIcon = new ImageIcon(cardPathB);
                    imageButton.setIcon(myImageIcon);
            public static void main(String[] args){
                ImageChange test = new ImageChange();
                test.makeGui();
    }Calypso

  • Safari not loading images with UK2 webmail

    Hi, i wonder if anyone can shed any light on this for me please. I use UK2.net webmail which i access through safari on my imac and ipad. For the last couple of days images have stopped loading with all my emails, (and won't load at all). I have tried firefox on the imac and this works fine, so it is definitely a safari issue. I have contacted UK2 and they have said that it's a browser issue not an issue with their server and that i need to contact Apple to see if they know what this is. Is anyone else having this problem or can anyone suggest a fix?
    Thanks

    webmail which i access through safari on my imac and ipad. For the last couple of days images have stopped loading with all my emails
    Try emptying the cache on your iMac and iPad.
    One the iMac with Safari open, press Command + Option + E on the keyboard. Quit and relaunch Safari to test.
    On the iPad. Tap Settings > Safari. Tap Clear History then tap Clear Cookies and Data. Restart your iPad.

  • Load image with ROMMON Cat4000 Switch

    I have a Catalyst 4006 switch that boot to ROMMON. I am trying to figure out ohow to load the image from my PC to the switch. Command from a ROMMON list are very limited. There is no TFTP or XMODEM or YMODEM to assit in uploading the image. Any ideas?

    Did you even look at the douments I pointed to in my previous post before inferring my post was "not helpful"(rating of 1). CAT4000 switches do not support XMODEM and you will need to use the 10/100 MGMT port to boot the image from a PC/laptop and then TFTP it. You are a network admin and have to put some effort as well and not just expect people to spoon feed you. So spend a few minutes to read the documents since they descrive on how to recover the switch when there is no image in the bootflash and post any follow up questions you might have.

Maybe you are looking for

  • [SOLVED]how to avoid mutiple conky instances starting?

    I am facing this wierd problem of getting multiple conky instances(atleast 2-3) when I start my chakra arch linux. There is nothing in ~/.kdemod/Autostart directory. Even if I keep only one conky instance running and do a manual reboot/shutdown inste

  • Address quality

    is this tool integrated with the data quality tools or do most people use third party - looks like we need some address cleansing

  • Define lenght in SE51 will change upon transporting

    Hi Expert's, Good Day! I would like some help regarding my object on transaction SE51 (screen painter). I was changing the Define Length from 45 to 55 upon activating their will be a pop-up information message will appear "Selection screen: Report ge

  • Install EPMA in Arabic language

    My client want to see the Oracle EPMA screen in arabic language. Is it possible to view both English and Arabic view if i install and configure in Arabic language. Please reply if any one used this language feature in EPMA 11.1.2.2 version

  • Why is script Chrome://global/content/bindings/browser.xml/244 and 245 not working?

    Accessing my bank, Firefox keeps giving the above error messages and not responding. Thunderbird is also afflicted with "not responding" I now use Opera which does not have any problems.