Problem: Images won't show up in animation.

I'm trying to get a series of images to animate in an applet. So far I haven't been able to work out what I've done wrong/altered incorrectly, because all I get on the applet is a blank light grey background. None of the pictures will show up, even though they are in the same directory.
The images are named F0.jpg, F1.jpg etc all the way up to F10.jpg.
Any help would be most appreciated since I can't see any part of the coding that would affect the images not showing up.
Thanks!
import java.awt.*;
public class FMAni extends javax.swing.JApplet
   implements Runnable {
   Image[] picture = new Image[11];
   int totalPictures = 11;  // determines how many different images will be displayed.
   int current = 0;
   Thread runner;
   int pause = 500; // specifies the speed of the animation.
   public void init() {
     for (int i = 0; i < 11; i++) {
       String imageText = null;
       imageText = getParameter("F" +i+ ".jpg");
       if (imageText != null) {
         totalPictures++;
         picture[i] = getImage(getCodeBase(), "F0.jpg");
       } else
         break;
     String pauseText = null;
     pauseText = getParameter("pause");
     if (pauseText != null) {
       pause = Integer.parseInt(pauseText);  // converts the text into an integer.
   public void paint(Graphics screen) {
     super.paint(screen);
     Graphics2D screen2D = (Graphics2D) screen;
     if (picture[current] != null)
       screen2D.drawImage(picture[current], 0, 0, this);
   public void start() {
     if (runner == null) {
       runner = new Thread(this);
       runner.start();
   public void run() {
     Thread thisThread = Thread.currentThread();
     while (runner == thisThread) {  // causes following to loop until something causes the two thread objects to have different values.
       repaint();
       current++;
       if (current >= totalPictures)
         current = 0;
       try {
         Thread.sleep(pause); // determines how long each image is displayed until the next image is shown.
       } catch (InterruptedException e) { }
   public void stop() {
     if (runner != null) {
       runner = null;
}

I think so. Why not have a look and be sure? Simply print the references.
The images are all in the same folder as
the java files. I've tried tweaking that part
slightly to see if any slight alteration might make a
difference, but so far I've found nothing works.That only means that you didn't get it correct in other attempts. You can't conclude that it's correct from that...
Then again, I'm not all that experienced with java.
So I could be screwing up royally and not really
knowing it.Haven't touched Applets for a long time, but since you ask here rather than at the Swing forum, I have three guesses:
1) Image file can't be read by Java. But I think it can handle jpgs.
2) Image file not found.
3) Image file found but not yet loaded. Try using ImageIcon instead in that case. it blocks until the image is available.

Similar Messages

  • Hi, I have trouble loading my iPhone 5 photos into Aperture. The iPhone icon appears in the import window, but the images won't show up in the loading window.

    Hi, I have trouble loading my iPhone 5 photos into Aperture. The iPhone icon appears in the import window, but the images won't show up in the loading window

    The iPhone icon appears in the import window, but the images won't show up in the loading window
    Do your images show, if you disable the option "Do not import duplicates"? If yes, then check, if the images have already been imported, eg. using Photo Stream, if you are using Aperture 3.3 or later.
    Aperture 2, Mac OS X (10.6.8)
    Is your profile signature above still current?

  • Images won't show up when I try to upload online

    Hi
    I need help to figure out why my photos won't show up when I try to upload them online (e.g. Facebook, Pinterest, Google+). All of my photos are in iPhoto and it used to work fine until I updated to ver 9.3 a coupe of days ago. When I open iPhoto, it shows all the images but when I try to upload something, I couldn't find my photos so I end up copying them to my desktop first which is very inconvenient, especially if I am uploading severa photos. It works alright when I attach photos in Outlook though, so I'm not really sure what I'm doing wrong here. Any help is much appreciated. Thanks a lot!
    PS I did some screen shots if that would help explain things better. By the way, my OS version is 10.7.4, if that is relevant at all?
    This is my iPhoto right now.
    This is how it looks like when I open Photo Browser or attach an image to an email via Outlook.
    This is what it looks like when I try to upload images on to Facebook, Google+, Tumblr, etc.

    Where did you get the phone?
    If you see an ICCID unknown in Settings>General>About, that indicates a catastrophic failure. Very often this is caused by hacking or jailbreaking the phone. It can not be fixed. The phone will have to be replaced.

  • Images won't show up in edit mode

    Okay this one really has me baffled.
    When I go into Aperture 3.6 and go to edit images in either split view or viewer mode, the images won't display.  I can see the thumbnail preview, but nothing else.
    Help!

    That's not good  .
    Many — perhaps most — UI issues are resolved by deleting your preferences.  Instructions are on the Apple Trouble-shooting page.  You might first simply reboot if you haven't already.  Let us know how it goes.

  • Images won't show up after export

    I have exported a document to .pdf, it will open on the computer that created it and the images are intact in preview. but once I open the .pdf on a PC (taking it to get printed) in acrobat the images are not showing up. The mask and text show up but he images will not. I placed the images using the media browser within Pages. Any idea why this wont work.

    I don't really know why Acrobat (is it 'Acrobat Reader'?)would fail to show images since Adobe is The Image House. I do know that when I put images into text boxes and export the document to PDF, it looks fine on my iBook but looks like trash in Windows Acrobat Reader. Everything seems to be disconnected and both images and text may move to new positions. In my limited experience I have found that Quark XPress exported by Adobe Distiller will give predictable results more often than anything else. With Pages and even sometimes with MS Word, the results are variable.
    You have several options for creating a PDF file from a Pages file. Export from Pages, choose "Save as PDF" or similar wording from the print dialog window, use a third party application such as Adobe Distiller or Jaws PDF Creator. The results will vary not only in positioning of the objects (images, text boxes) but also in the function of links.
    We might like to think PDF is like a picture but it is really more like a composit of text and object layers that can be printed with fairly predictable results. Depending on the document, the results are not always precisely what you want. If the various 'layers' appear out of position, you have to go back to the original and reposition them or change fonts and re-export the document.
    Are your images JPG? I have also found that most Windows applications have trouble with PNG images and may not see them at all. Try converting every image to JPG so Windows doesn't freak out. Also, be sure the Windows computer is using Adobe Reader 8.1.1 not only for best results but also because a security flaw was addressed by the update.

  • Bitmap image won't show after converting HTML file to pdf

    I have a program which saves a technical report as a HTML file. I don't  have another choice as to file type to save as. This program has a  template which generates the report....and there are fields which are  filled in...some text fields, and one is a company logo. Just to be  clear the logo itself is not in the template, a holding place is there  which points to the location of the logo on my drive. This is all set up  by the program and can't be altered.
    If I save the logo as a jpg, png or tiff file, the logo shows up in the  final HTML report and if I use Adobe Professional (version 7.0 on Win XP)  to create a pdf the  image also shows up - a perfect replica of the report is created in pdf,  making it convenient for printing and email.
    If I save the logo as a bitmap file (which creates a higher resolution  and sharper looking logo) the logo shows up in the initial HTML  technical report, but when I convert this to pdf the file is not found,  instead it shows as a small square red box with the error "Bad file  image" or "unable to download image".
    I can't understand why this would be the case as the logo is saved in  the same location whether it is jpg, png, tiff or bmp. It just seems  that the Adobe Pro doesn't know how to "find" the bitmap logo from the  HTML template. 
    I did try converting the HTML document to Word but it threw the  formatting out and when it was converted to pdf it cropped the page  & I wasn't able to resolve this...maybe it can be done but it is a  long way around in any case, particularly if steps then need to be taken  to correct the formatting.
    At the moment the document can be printed with success from the original  format - then it's a matter of scanning the printed document in order  to email. It can't be emailed directly because of the embedded  information which is lost if then sent to the recipient's computer.  However it would be nice if the doc could be converted to pdf which  would then make it easier to transfer the file to a backup drive or for  email.  Any ideas? Thanks

    Thanks for your response. Yes I did mean .bmp files.
    The problem is not getting it to show in HTML - but Adobe then picking it up from there. I guess though if it is not a standard format for HTML then maybe Adobe has trouble recognising it if it is there. Also, it is possible for Adobe to convert .bmp files if they are inserted in the HTML file, but I have instead a template with the code for the location of the file rather than the graphic itself.  I don't have this problem using the other file formats and getting them into pdf...it's just that the images aren't as sharp as the bmp. I have tried various formats and resolutions so if there isn't a way I can get the bmp from the HTML file into pdf I might just have to live with printing and scanning from the original. Thanks for your input, it confirms what I was thinking. I'll leave this unanswered for now in case someone else has further information.

  • Images won't show on Display

    hey, i'm just starting out with MIDP programming. i created a MIDlet with a Canvas and tried to display an image but it just doesn't show. at first i didn't get any errors or exceptions but after a bit of tweaking i got this exception:
    java.io.IOException
            at javax.microedition.lcdui.ImmutableImage.getImageFromStream(Image.java:971)
            at javax.microedition.lcdui.ImmutableImage.<init>(Image.java:942)
            at javax.microedition.lcdui.Image.createImage(Image.java:310)
            at hello.MyCanvas.paint(GraphicsMIDlet.java:62)
            at javax.microedition.lcdui.Canvas.callPaint(Canvas.java:1074)
            at javax.microedition.lcdui.Display.repaint(Display.java:1566)
            at javax.microedition.lcdui.Display.registerNewCurrent(Display.java:1872)
            at javax.microedition.lcdui.Display.access$700(Display.java:221)
            at javax.microedition.lcdui.Display$DisplayAccessor.foregroundNotify(Display.java:2344)
            at javax.microedition.lcdui.Display$DisplayManagerImpl.notifyWantsForeground(Display.java:3126)
            at javax.microedition.lcdui.Display$DisplayManagerImpl.access$100(Display.java:2565)
            at javax.microedition.lcdui.Display.setCurrent(Display.java:843)
            at hello.GraphicsMIDlet.startApp(GraphicsMIDlet.java:19)
            at javax.microedition.midlet.MIDletProxy.startApp(MIDletProxy.java:43)
            at com.sun.midp.midlet.Scheduler.schedule(Scheduler.java:374)
            at com.sun.midp.main.Main.runLocalClass(Main.java:466)
            at com.sun.midp.main.Main.main(Main.java:120)and here's my MIDlet's code:
    package hello;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.IOException;
    public class GraphicsMIDlet extends MIDlet
      private Display  display;
      private MyCanvas canvas;
      public GraphicsMIDlet ()
        display = Display.getDisplay(this);
        canvas  = new MyCanvas(this);
      protected void startApp()
        display.setCurrent( canvas );
      protected void pauseApp()
      protected void destroyApp( boolean unconditional )
      public void exitMIDlet()
        destroyApp(true);
        notifyDestroyed();
    class MyCanvas extends Canvas implements CommandListener
      private Command exit;
      private Command refresh;
      private GraphicsMIDlet filledRectangleExample;
      Image img;
      public MyCanvas (GraphicsMIDlet filledRectangleExample)
        this. filledRectangleExample = filledRectangleExample;
        exit = new Command("Exit", Command.EXIT, 1);
        refresh = new Command("Refresh", Command.OK, 2);
        addCommand(exit);
        addCommand(refresh);
        setCommandListener(this);
        img = null;
      public void paint(Graphics graphics)
        graphics.setColor(255,255,255);
        graphics.fillRect(0, 0, getWidth(), getHeight());
        graphics.setColor(0, 0, 255);
        graphics.drawLine(2, 2, 19, 19);
        graphics.setColor(0, 255, 0);
        graphics.fillRoundRect(20, 20, 60, 60, 15, 45);
        graphics.setColor(0, 0, 0);
        graphics.drawString("Hello World", 10, 100, 0);
        if (img == null) {
                try {
                    img = Image.createImage("/ball.png");
                    //setFullScreenMode(true);
                } catch (IOException e) {
                    e.printStackTrace();
                    return;
        else if (img != null){
            graphics.drawImage(img, 100, 100, Graphics.VCENTER);
      public void commandAction(Command command, Displayable displayable)
        if (command == exit)
            filledRectangleExample.exitMIDlet();
    }i have no idea what exception means or how to fix it. the other graphics show on the screen without a problem. i also tried both jpg and png formats, none seem to work. did i get the image's destination wrong? the images showed up in the projects window so i assumed that i got it right. if not then which folder should i put the images in? or what am i doing wrong?

    line # 74 refers to the drawimage method, after editing the code drawimage is currently in line # 73
    ok i removed the constructor for the MIDlet class and moved everything to startApp()
    moved the image to the MIDlet class and initialized it in startApp() also
    the image did have transparent pictures so i changed it and put an image with no transparent or partially transparent pixels
    added repaint() method to the refresh command event cause i realized the first time paint is done the image isn't initialized yet so i get no errors sometimes and still don't see the image. (should i repaint in the MIDlet class instead?)
    created a res folder in the project's folder and added it to the resources in the project and copied the images folder from the src folder to there, so its in both folders
    commented the other draw functions as you suggested
    removed the anchor and put its integer value instead (Graphics.TOP = 16)
    here's what my code currently looks like:
    package hello;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import java.io.IOException;
    public class GraphicsMIDlet extends MIDlet
      private Display  display;
      private MyCanvas C;
      Image img = null;
      protected void startApp()
        display = Display.getDisplay(this);
        C  = new MyCanvas(this);
        display.setCurrent( C );
        img = null;
        if (img == null) {
                try {
                    img = Image.createImage("/images/Duke.png");
                    //setFullScreenMode(true);
                } catch (IOException e) {
                    e.printStackTrace();
                    return;
      protected void pauseApp()
      protected void destroyApp( boolean unconditional )
      public void exitMIDlet()
        destroyApp(true);
        notifyDestroyed();
    class MyCanvas extends Canvas implements CommandListener
      private Command exit;
      private Command refresh;
      private GraphicsMIDlet filledRectangleExample;
      //Timer t;
      public MyCanvas (GraphicsMIDlet filledRectangleExample)
          //t = new Timer();
          this. filledRectangleExample = filledRectangleExample;
          exit = new Command("Exit", Command.EXIT, 1);
          refresh = new Command("Refresh", Command.OK, 2);
          addCommand(exit);
          addCommand(refresh);
          setCommandListener(this);
      public void paint(Graphics graphics)
    //    graphics.setColor(255,255,255);
    //    graphics.fillRect(0, 0, getWidth(), getHeight());
    //    graphics.setColor(0, 0, 255);
    //    graphics.drawLine(2, 2, 19, 19);
    //    graphics.setColor(0, 255, 0);
    //    graphics.fillRoundRect(20, 20, 60, 60, 15, 45);
    //    graphics.setColor(0, 0, 0);
    //    graphics.drawString("Hello World", 10, 100, 0);
        if (filledRectangleExample.img != null){
            graphics.drawImage(filledRectangleExample.img, 0, 0, 16);
      public void commandAction(Command command, Displayable displayable)
        if (command == exit)
            filledRectangleExample.exitMIDlet();
        else if (command == refresh){
            repaint();
    }i debugged the program again, i put a break point at the draw image condition. the first time the paint function runs the image value is null so drawimage is never executed, when i press refresh and repaint is called, the image's value isn't null and drawimage is executed. at that point i get this exception :
    java.lang.IllegalArgumentException:
            at hello.MyCanvas.paint(GraphicsMIDlet.java:73)
            at javax.microedition.lcdui.Canvas.callPaint(Canvas.java:1074)
            at javax.microedition.lcdui.Display.repaint(Display.java:1566)
            at javax.microedition.lcdui.Display$DisplayAccessor.repaint(Display.java:2264)
            at javax.microedition.lcdui.Display$DisplayManagerImpl.repaint(Display.java:3012)
            at com.sun.midp.lcdui.DefaultEventHandler.repaintScreenEvent(DefaultEventHandler.java:394)
            at com.sun.midp.lcdui.DefaultEventHandler$QueuedEventHandler.run(DefaultEventHandler.java:665)line 73 refers to drawimage()
    i've yet to try using a Form class and using image item, i'll let you know as soon as i do that. also i'm gonna try tinkering with the ready made example i have and see if i find out what i'm doing wrong.
    thanks i really appreciate your help

  • Images won't show in pdf file

    I create a file in Publisher and insert images as .gif files (have also saved as .jpeg). No problem. But as soon as I convert them over to pdf the image is replaced by a gray box. Now if I print the pdf file the images show and print just fine. Why would they change during conversion? Also this just started today. When I left work on Friday my images were just fine in pdf. The only thing I was attempting to do was adjust the display preferences so the pages started out smaller rather than zoomed out to 151%, which it was defaulting too.
    Any help would be greatly appreciated
    Sara Dreger

    Thanks so much. I have no idea how that got turned off, but it was.
    Thanks again
    Sara

  • My iPhoto images won't show, and Photo Library Repair will not open when I command-Option-click on the iPhoto icon.

    Some of my iPhoto albums will not show, as below:
    When I click on any of those individual albums, for a brief split second I can see the images displayed, but then they revert to this:
    Then if I click on any of those images, this image appears:
    I have real a lot of posts that say to click Command+Option while opening iPhoto and this will open the Photo Library Repair window, but... this is not happening. Each time I do it, iPhoto just opens as it normally does. I've tried about 10 times, closing iPhoto completely. I've tried through the dock icon and through the applications listing. Neither will open anything other than regular old iPhoto.
    Can anyone help me and suggest what I may be doing wrong, or are there any alternative was to open Photo Library Repair so I can rebuild my library? I really don't want to lose all of those photos, especially since some are really important and irreplaceable.
    Thanks.

    I have real a lot of posts that say to click Command+Option while opening iPhoto and this will open the Photo Library Repair window, but... this is not happening.
    Be sure you're holding the correct keys and that you're holding them long enough. Depress them before clicking on iPhoto and don't let go until the menu shows up.
    If you don't want to lose those photos, make a back up now. Hopefully it's not too late.

  • Document Images won't show up when opened by Windows Users

    When using Pages or Microsoft Office 2004 for MAC to create documents that have .giff, .jpeg or.jpg images in them my Windows based recipients can not view the images.  This was also an issue with HTML pages I created in TextEdit.  The recipient can see everything in the document or page except the images which have a red "x" or a blank screen with a message that states "quicktime and a decompressor are needed to view this file".  It even happens when the recipient has the same update of quicktime that I do and when I use MAC's Grab utility....Please help, this issue is adversly affecting my grade in technology class and since the instructor is not a MAC user they have offered no help or sympathy. What's really frustrating was there was no issues viewing images in documents before the end of March.

    All documents have a .doc extension and again I have to ask why one picture on the same document might show but not the other and why this only started at the end of March?  This was not an issue I had before then.  I could try saving as a PDF but the assignments must be turned in as a .doc or .rtf so a PDF format would not help me. I have the same issue whether I use .rtf or .doc.  I assume it is a Quicktime issue or a setting I have made or changed.  I read a few online forums where people had difficulting viewing images in PP or QT and they attributed it to a bug in the QT update that could onlybe fixed with a complete OS re-install and not reinstalling QT.  It makes sense in someways, given that this is a new issue, however why does it randomly select images?  I can't afford a complete OS install.  I guess I will have to take both my PC and MAC to the Apple store an hour from here and have someone look at what I'm experiencing.  Another hassel I was hoping to avoid, but I can't keep ignoring random loss of images for the rest of my life and I get the feeling this is an issue that doesn't have a forum answer.
    Thanks for trying though....

  • XML links and images won't show up

    Can someone help me with links not showing up from my
    external xml file? I am trying to load an xml file that contains
    news, its basically an rss feed xml file i am trying to use a CSS
    file to make the links and images show up but to no avail. What do
    i have to do for the links to be clickable rather than just show up
    like <a-href="etc....

    try this: <item><![CDATA[type all the stuff here
    then <a href="your URL" target="_blank">link
    info</a>]]></item> it should work with the CSS but
    if not, add this <font color="#000000"><a
    href....</a></font>

  • Images won't show up in Dashboard

    So I had been playing around with Photoshop and did something to delete it and had to re install the whole thing.
    Shortly thereafter, I downloaded the "Aquarium" and "Have a Studio" widgets. The audio is coming through fine, I'm hearing the water for Aquarium and if I randomly click on the image-less screen of Have a Studio I'll hear a piano key, etc.
    My question is: What the **** happened?! lol I don't know if deleting and re installing Photoshop has anything to do with my images not showing up, did I accidentally delete a file I needed for Dashboard images? Does one have nothing to do with the other? Why can't I see the **** fishes in Aquarium?!
    If anyone can help out, it'd be greatly appreciated
    Vanessa

    Welcome to Apple Discussions!
    You can create a new user account and re-install your two Widget there. Do they work?
    I would also suggest that you re-install your two Widgets in your current user account.
    Last, "Repair Disk Permissions" from Disk Utility may help you.
    Mihalis.

  • Images won't show up in browser

    Hi everyone,
    I am working on publishing my first website, which is also my porfolio. For some reason all the image links are broken or something? I have gone into dreamweaver and tried re-linking them, but they still aren't showing up? I have no idea how to fix this, and your help would be greatly appreciated.
    Currently i have the first page uploaded: www.meganpowell.ca
    Thanks
    Megan

    Hi Megan,
    Your code has some critical errors that need fixing and you haven't uploaded images to your server yet.
    On line 44 of code view, change all this:
    </head>
    <div id="main icon"><a href="Home Page2.html"><img src="pictures1/Home page icon.jpg" width="600" height="540" align="right" /></a></div>
    <body leftmargin="100 px" topmargin="100 px" marginwidth="100 px" marginheight="100 px">
    to just this:
    </head>
    <body>
    <div id="main icon"><a href="HomePage2.html"><img src="pictures1/Homepageicon.jpg" width="600" height="540"></a></div>
    IMPORTANT!  Don't use spaces in your folder, file or image names because they don't translate well on the web.  You can use hyphens or underscores between words but not spaces or any other special characters.
    Nancy O.

  • Email - Lag,cutting off,images won't show up within email!

    A short while ago,I lost images in my email.Tried a restore,no luck.Deleted/re-entered information,still no luck.Haven't exactly been able to get to the Apple store.I let that go for now.Yesterday,my email started to lag badly.It was maybe 10 seconds between hitting Send and the email actually sending.Now I can't reply to email threads I've had going.The app crashes on me and then I can't mark the email unread without it changing it back to read.I can send out new emails,just seemingly unable to reply without crashing.It's started crashing when I hit Send on replies too.It's an AOL account I've had for a while and nothing like this has happened before.
    I have cleared my Safari history,closed pages in hopes to solve the lag too as well as force closing the app to no avail.

    Hi,
    Welcome to Apple Discussions!
    iLoveRainbows wrote:
    Tried a restore, no luck...
    You said you tried a restore. Have you tried a reset? Press and hold the home and sleep/wake buttons down until the Apple logo appears.
    Hope this helps!

  • Images won't show on a mac

    I've created html/php pages on a pc at work in Dreamweaver.
    When I'm at home and viewing the pages on my Mac in Safari or Firefox, I can not see the images for the advertising section of my website I've created.
    Any thoughts on why this would be?
    Thanks,
    Jeanne

    Aha! Success on my part with Firefox over here.
    I was wondering why I could only see the 'I am Africa' pictures and noticed the path to those was for '..../celebrities/...'. All the others have '.../advertising.../' in their path - and of course, I have AdBlock installed on Firefox
    Do you use AdBlock by any chance...?
    Edit: Once I turn off AdBlock, all the images appear.

Maybe you are looking for

  • USB problems since EFI firmware update 2.6

    My MBA has been suffering USB problems since this update. I have an IOGear USB 3 GUH374 hub.  I connect my iPad mini and USB 3 disk to it. Since the update, the iPad has stopped charging through the hub.  Now, I can't find the power specs of the hub,

  • Can you force a link inside a .pdf to open the "linked to" document in a new window?

    When I have a link inside my .pdf document - linking to another .pdf document or to a Word document - how can I force the linked-to document to open in a new window? I have a web site (business internal, so unfortunately I cannot point to it).  My HT

  • Exchange rate difference in to different G/L account

    Dear All, Ex: I have raised a PO for Imports with account assignment category "Q",during creation of purchase order the Exchage rate was 46.65 INR. when i'm doing Invoice MIRO the exchage rate is 48.85.The difference is going against WBS element.But

  • Problem using 'the current day' attribute in a rule

    Hi, I have encountered an issue where the following two rules, (the second rule in word document table as best I can depict) will not compilewill not compile: the current time of day = ExtractTimeOfDay(the current time) |the earliest start date time

  • NEED TO DISPLAY A COLUMN as HYPERLINK IN discoverer viewer 10g

    Hi Guys, We have a requirement from the customer and the requirement goes like this :: We have a table in database which has a column which stores the link as VARCHAR.. For example, it has a value https://www.google.com as varchar in database. We are