Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 loading picture into J2ME
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tupac




PostPosted: Wed Jul 05, 2006 5:53 pm   Post subject: loading picture into J2ME

I've got a problem, i keep getting errors when i try loading 2 pictures into my program. I have the 2 images sitting in my "SlideShow\src\SlideShow" folder (where my 2 classes are sitting). Java understands the 2 .jpg's sitting there, it even shows it in the IDE (netbeans), but when i run it, it doesnt give me a formal error (underlined in red, or red lettering in the debugger), but just a little side note up top (i found it while searching if it ever complained, and it did). So this is my code:
code:
    public SSCanvas(Display d) {
        super();
        display = d;
        try{
            slides = new Image[2];
            slides[0] = Image.createImage("/DDK.jpg");
            slides[1] = Image.createImage("/WOG.jpg");
        }
        catch (IOException e){
            System.err.println("Failed loading images!");
        }
    }
   
    /**
     * paint
     */
    public void paint(Graphics g) {
        g.setColor(255,255,255);
        g.fillRect(0,0, getWidth(), getHeight());
        g.drawImage(slides[curSlide],  getWidth()/2, getHeight()/2, Graphics.HCENTER | Graphics.VCENTER);
        Font f = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
        g.setFont(f);
        g.setColor(0,0,0);
        g.drawString(captions[curSlide],  getWidth(), 0, Graphics.HCENTER | Graphics.TOP);
    }
    void start(){
        display.setCurrent(this);
        repaint();
    }

This, of course, is only part of my code, slides is an array, so are the captions. This is btw in my "MIDP canvas"
if anyone can help me, i would greatly appreciate it.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: