Please Help!-Problem using Image[ ] array

Hi everyone,
I have this real confusing bug in my code which i am not able to fix.
Image[] tmpImg = new Image[Img.size()];   /initializing an image array tmpImg
            for(int i=0; i<Img.size(); i++) {          //i require this display the image a number of times
            try{
                   icon = Image.createImage("/Icon.png");
                   im = new ImageItem("Image", icon,ImageItem.LAYOUT_CENTER,"image"); //using a imageItem to display the image in a form
                   form.append(im);
                   icon2 = Image.createImage("/Icon2.png");
                       im2 = new ImageItem("Image2",icon2,ImageItem.LAYOUT_CENTER,"image"); //using another imageItem to display the second image
                  form.append(im2);
                   if (imageValue.elementAt(i) == "availableImage") {
                       tmpImg[i] = icon;  //assigning the value to the image array based on a condition from a String Vector
                  if (imageValue.elementAt(i) == "offlineImage") {
     tmpImg[i] = icon2;   //assigning the value to the image array based on a condition from a String Vector
                  } catch(IOException err) {}
       System.out.println(tmpImg[0]);
       System.out.println(tmpImg[1]);
       System.out.println(tmpImg[2]);
       System.out.println(tmpImg[3]);
       return tmpImg;
   }My problem is that when i try to print tmpImg[0], tmpImg[1] etc all the values are printed null. But the Image is created and being displayed on a ImageItem. but i am not able to assign the image to the image array 'tmpImg' which is within an if condition.
Can anyone tell me why is this so. I would be grateful
Thank You

Thank u deepspace
I got a lil' frustrated, so completely did not think that way. The code is working now
Thanx again

Similar Messages

  • Please help, i used to have various colors to select from when selecting FILL in Keynote such as red, now I only have a few pastel colors. I cannot seem to fix this problem to get the original colors back. Can someone please advise what I need to do.

    Please help, i used to have various colors to select from when selecting FILL in Keynote such as red, now I only have a few pastel colors. I cannot seem to fix this problem to get the original colors back. Can someone please advise what I need to do.

    i have on my ipad2 and re-download it - but I can't afford to loose the presentation that I currently have ....??
    Are you using Keynote on an iPad?
    If so you posted in the wrong forum, this is the Keynote Mac discussion and it is a different application. I dont know how the iPad works at all, so I cant help you, post in the Keynote iOS discussion.
    If you are using a Mac, the colours palette is accesed by clicking on the colour well (arrowed) and then selecting a colour chip or changing the color in the colour wheel.

  • Please help, my Canon Image Formula P-215 will not work w/ Mavericks

    Please help, my canon image formula p-215 will not work w/ the new mavericks upgrade, is there a work around?

    I ran into the same problem, I posted what worked for me in another topic in this forum:
    https://discussions.apple.com/message/25208435#25208435
    Hope it helps

  • I have updated my iPhone 4s to iOS7 but when i connect it to itunes on my PC it give me a msg to restore your iPhone in summary tab, Please help m using win 7 and updated itunes.

    I have updated my iPhone 4s to iOS7 but when i connect it to itunes on my PC it give me a msg to restore your iPhone in summary tab, Please help m using win 7 and updated itunes.

    What is showing on the screen of the iPhone?
    Does iTunes say the iPhone is in recovery mode?

  • I have to upload video from my hewlett packard t200 camcorder to my mac. but mac won't recognize the camcorder files. i even bought flip4mac by tele stream which so far is useless. please help me use my camcorder with my iMac os mountain lion 10.8.2

    i have to upload video from my hewlett packard t200 camcorder to my mac. but mac won't recognize the camcorder files. i even bought flip4mac by tele stream which so far is useless. please help me use my camcorder with my iMac os mountain lion 10.8.2
    i tried to get the installation disc for the camcorder but mac wont' recognize it becaue it is windows based i guess.
    i just bought the camcorder a few months ago and when my computer crashed thought i'm finally getting a mac...it's been a costly venture which has resulted in more frustration than before my pc.
    now the things i want to use with my mac that i thought would be even simpler...are not even useable...
    help

    That camera shoots H.264 in an .avi wrapper.
    You will have to transfer the files via the Finder.
    Get a free copy of MPEG Streamclip and convert them to QuickTime .mov using the H.264 codec if you are presumably editing in iMovie.
    Note that your list of video codecs won't look like mine as I have Final Cut Pro, but H.264 is definitely an option for you.

  • Premiere Pro CS5: please help problem with importing a file error output "there was an error decompressing audio or video"

    please help problem with importing a file error output "there was an error decompressing audio or video"

    this is related to what adobe program/version?

  • I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)

    I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)

    Goto > Settings > Safari... Enable Cookies > Always
    Good luck!

  • Flex 4.5 problem using image in Mobile Application (Android)

    I have a problem using flex and mobile application...
    I have an image with path = "/mnt/sdcard/images/20120202172020990.jpg"
    Simply using
         <s:Image id="image" source="/mnt/sdcard/images/20120202172020990.jpg" />
    Get me an empty image on device, still using it on computer (desktop build / debug) it works fine...
    I have enabled every kind of permission in the app.xml
    Why I got this error?

    I actually solved the problem using:
    image.source = File.desktopDirectory.resolvePath(file_name).url;
    using instead this one it will work only under windows...
    image.source = File.desktopDirectory.resolvePath(file_name).nativePath;
    I don't know if it's a bug or whatelse, but I think that the source property of Image passing a filename that start with / (/ is root for unix based OS, android, linux, ios, etc), will take is as a relative path instead of complete path...

  • Please help. Using Ipad 2 . No connection error iPad 2 Wi-Fi, iOS 7

    Please help. Using Ipad 2 . No connection error
    iPad 2 Wi-Fi, iOS 7
    how to start back my i pad

    Please see: iOS: Restore errors 4005, 4013, and 4014
    Regards,
    Steve

  • Please, Please Help Me (.gif Images)

    Hello,
    I want to cry, I've been trying to include .gif images in my swing applications but am having big problems. I've been reading the forums and trying everything. If I try the most basic of examples just to get it working I still have problems. The code compiles correctly and the panels appear but no pics. I've tried including every different file path version, moving .gifs to different folders, what is the problem, why no pics. I'm running J2SE v 1.4.1_02, please help, I would be so greatful, don't make me cry,
    Lucy
    import java.awt.*;
    import javax.swing.*;
    public class JFrameImage extends JFrame
    public JFrameImage()
    Container c = getContentPane();
    JPanel panel = new JPanel()
    public void paintComponent(Graphics g)
    ImageIcon img = new ImageIcon("globe.gif");
    g.drawImage(img.getImage(), 0, 0, null);
    super.paintComponent(g);
    panel.setOpaque(false);
    ImageIcon icon = new ImageIcon("cat.gif");
    JButton button = new JButton(icon);
    panel.add(button);
    c.add(panel);
    public static void main(String[] args)
    JFrameImage frame = new JFrameImage();
    Image onFrame = Toolkit.getDefaultToolkit().getImage("icon.gif") ;
    frame.setIconImage(onFrame);
    frame.setSize(200,200);
    frame.setLocation(300,200);
    frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
    frame.setVisible(true);

    sorry but I think it should be something else.
    To locate a File you need it's full name, including the extension. Maybe since the extension wasn't showing it's actual filename was cat.gif.gif? I don't know. Anyway, this is a method I use for all my image retrieving, just put it in some Util-class:  private static HashMap hmImages = new HashMap();
      public static ImageIcon getImage (String name)
        if (hmImages.containsKey(name))
          return (ImageIcon) hmImages.get(name);
        String url = System.getProperty("user.dir") + "/resources/" + name;//or any other directory were all your image-files are under (even in subs, in that case add the subdirectory to the arg name
        try
          ImageIcon ic = new ImageIcon (url);
          if (ic != null)
            hmImages.put(name, ic);
            return ic;
        catch (Exception e)
        System.out.println("Warning: image '" + url + "' not found");
        return null;
      }greetz,
    Stijn

  • Please Help me on Image Scaling!!

    I am trying to get a map.jpg to scale to fit the window while still able to zoom in & out with mouselistener(which where I clicked). I am able to zoom in & out but the coordinate is according to the original size. Please help.

    1.I am not familiar with Graphics & Graphics2D. The Following code have problem in showing the map in BufferedImage, which is plotted with small dots on it. Actually, it's the Graphics & Graphics2D coding problem that I am facing. I don't know how to use the function.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    public class GPSMap extends JPanel
    private Image map,scaled;
    private double zoomfac=1;
    private BufferedImage bufi;
    int zoomcx,zoomcy,zoomh,zoomw,w,h,newHeight,newWidth,newx,newy,newcx,newcy;
    public GPSMap()
    System.out.println("Loading GPSStatus");
    this.setLayout(new BorderLayout());
    map = getToolkit().getImage("Map3.jpg");
    MediaTracker track=new MediaTracker(this);
    track.addImage(map,0);
    try{track.waitForID(0);}
    catch(InterruptedException ie){}
    w=map.getWidth(this);
    h=map.getHeight(this);
    bufi=new BufferedImage(w,h,BufferedImage.TYPE_INT_ARGB_PRE);
    newHeight=650;
    newWidth=(int)(newHeight*w/h);
    scaled=map.getScaledInstance(newWidth,newHeight,map.SCALE_SMOOTH);
    addMouseMotionListener(new MouseMotionAdapter()
    public void mouseMoved(MouseEvent m)
         System.out.println("Move at ["+m.getX()+", "+m.getY()+"]");
    zoomcx = m.getX()-(zoomw/2);
    zoomcy = m.getY()-(zoomh/2);
         newx=(int)(m.getX()*newWidth/w);
         newy=(int)(m.getX()*newHeight/h);
         newcx=newx-(zoomw/2);
         newcy=newy-(zoomh/2);
    if (zoomcx <= 0)
    zoomcx = 0;
    if (zoomcy <= 0)
    zoomcy = 0;
    // if (zoomfac != 1)
    // repaint();
    repaint();
    The following part is an extra but cannot do it.
    addMouseListener(new MouseAdapter()
    public void mouseReleased(MouseEvent m)
    if (m.getModifiers() == InputEvent.BUTTON3_MASK)
    zoomfac = zoomfac - 0.21;
    else
    zoomfac = zoomfac + 0.21;
         if (zoomfac <=1)
         zoomfac=1;
    repaint();
    public void paint (Graphics g)
    GPS3 s3=new GPS3();
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHints(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_SPEED);
    Graphics2D gc=bufi.createGraphics();
    gc.setColor(Color.red);
    for(int i=0;i<=s3.ix.length;i++){
         gc.drawRect(s3.iy[i]-1,s3.ix[i]-1,2,2);//For plotting purposes, but not yet finish
    gc.drawImage(scaled,50,50,this);
    gc.drawImage(bufi,zoomcx,zoomcy,newcx,newcy,100,70,this);
    P.S. I don't know how to change it to runnable application. Please help.

  • Please help with ovals and arrays

    i'm creating an array that will be used to create a number of bubbles (simple ovals) on the screen. I can create 1 bubble/oval with no problem, but when i use the array to create multiple ones, everything craches and i get a big number of errors.
    Can someone please help or point me in the right direction?
    thank you
    Marko
    p.s. the code that i'm using at the moment is listed below. * to draw 1 oval, array not used
    import java.awt.Color;
    import java.awt.Graphics;
    import javax.swing.JPanel;
    import javax.swing.JFrame;
    public class Bubbles extends JPanel
        int array[] = {1,2,3,4,5};
        public void paintComponent(Graphics g)
            super.paintComponent(g);
            this.setBackground(Color.WHITE);
            for(int x = 0; x<5; x++)
            g.setColor(Color.BLUE);
            g.drawOval((array.(30,30,100,100));
    public static void main( String args[])
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Bubbles b = new Bubbles();
    b.setBackground(Color.WHITE);
    frame.getContentPane().add(b);
    frame.setSize(400, 400);
    frame.setVisible(true);

    Finally, this plug-in is ready for beta testing on www.amazoncanvas.com
    Thank you all who have participated in this program.

  • Please help to use my class in a JSP

    Hi
    Please could someone help me i've started a new job and need to create like a "Add to shortlist" functionality to their website.
    I have created a class to create a cookie using the offerid specific to that page which is done in the doGet() method.
    Now, the problem is that i don't know how to basically make the cookie be created when the button is pressed.
    I have thought of using <jsp:useBean> and putting my class in there but don't know how to call the doGet() method, if you know what i mean.
    Otherwise i've thought of doing the cookie creating in the JSP but then also i don't know how to make by the click of a button, it creates a cookie with that offerid.
    PLEASE help!? If you need more info pls let me know,
    Btw i am new to this so sorry if this sounds stupid, but thanks in advance for ANY help!

    There is only one thing to do in your case: hit the books and learn how to properly program servlets and JSPs - until you know at least the very basics (clicking a button and "doing something" falls in that category), it will be impossible to guide you to anything productive. I've seen it happen before many times; an answer is given, the answer is not understood and then the demand for "sample code" pops up, after which it all goes downhill fast.
    I always recommend this free online book, because it is quite good:
    [http://pdf.coreservlets.com/|http://pdf.coreservlets.com/]
    If you buckle down, you should be able to get things up and running in a few days. Good luck!

  • Ebay states "This Connection Is Untrusted" and has done for a long time - please help me use ebay again!

    For a long time now, every time I've tried to log in to ebay (I can get into ebay, but I cannot log into my account, etc) or Paypal (I cannot even access this site), I get an error message stating that "the connection is untrusted" "You have asked Firefox to connect securely to signin.ebay.com, but we can't confirm that your connection is secure".- I've tried the standard solution i.e. resetting the time and date on my computer, but still this does not work.
    Please help as this is severely restricting the use on my computer - and it's frustrating as hell!
    Many thanks

    Try to rename the cert8.db file in the Firefox profile folder to cert8.db.old or delete the cert8.db file to remove intermediate certificates that Firefox has stored.
    If that helped to solve the problem then you can remove the renamed cert8.db.old file.<br />
    Otherwise you can rename (or copy) the cert8.db.old file to cert8.db to restore the previous intermediate certificates.<br />
    Firefox will automatically store intermediate certificates when you visit websites that send such a certificate.
    If that didn't help then remove or rename secmod.db (secmod.db.old) as well.
    You can use this button to go to the Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)
    *http://kb.mozillazine.org/Profile_folder_-_Firefox

  • Please help me use wine (Darwine) for StarEdit

    I read the topic further down the page, but I just want technical support on using the wine application. I solely want this to run Staredit, because I've been unable to find any other way to run it. I've downloaded the disk image, and I followed the installation process: Dragging it into my "applications" folder. .
    My friend tried running wine using Terminal, but he said it wasn't installed, so I tried again (drag the darwine folder to apps), but now I don't know what to do. I need step-by-step instructions for running StarEdit using Darwine. Please help!

    To get any help with this you should ask in the Unix forum:
    http://discussions.apple.com/forum.jspa?forumID=735
    and use google for find others trying to make Wine work, e.g.
    http://forum.insanelymac.com/index.php?showtopic=10331&st=0&p=64512&
    How about CrossOver instead?

Maybe you are looking for

  • How can i get user to use my application without logging on as a developer?

    Hi Can anyone tell me or point me in the direction of information regarding allowing users to be pointed straight to an application on apex. Curently i log in via the apex.oracle.com home page use my database name then my username and password. But t

  • IP address has been blacklisted as spam

    Verizon FiOS is my Internet service.  I have two e-mail addresses that I regularly use: an aol one and a gmail one. This week I sent an e-mail from my aol account to a family member (who has a verizon.net e-mail address.)  It was returned with a mess

  • Need to hide a toolbar using plug-in

    I'm trying to create a plug-in that would customize the default toolbar which loads in acrobat. I know the methods to retrieve the toolbar n hide buttons individually. I tried this : const char * toolbarName= "Tasks" ;AVToolBar myToolBar = AVAppGetTo

  • The Floppy Disk Drive

    I tried to insert my floppy disk into the super drive on the right hand side of my iMac G5 but it didden't mount?

  • Function call statement parameters

    I have called some functions within a select query and the parameters are mentioned in the function call. month, department_code,office,finincial_year are the input parameters these are fetched from the selected columns and are passed as parameters t