NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Adding image to a midlet form in Netbeans 6.8

 
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users
View previous topic :: View next topic  
Author Message
rzs



Joined: 14 Jul 2010
Posts: 1

PostPosted: Wed Jul 14, 2010 4:07 pm    Post subject: Adding image to a midlet form in Netbeans 6.8 Reply with quote

Hello,

Im using Netbeans 6.8. I want to add a jpg file to a form. The code i wrote for that is shown below. Is that correct ?. Also, where to place the image in my project folder ?
I created a folder called images in my main project directory, and added the image to it.
Then I added the folder to resources by going to my Project Properties->Libraries and Resources and then adding the images folder.
But,when i run the program in the emulator, i get java.io.IOException.

Am i adding the image the right way ?

Code:

try{
        image = Image.createImage("/images/pic.jpg");
  }
catch(Exception e){
 System.out.println("Error:"+e);
 errorMessage.setLabel("Error:");
 errorMessage.setText(e.toString());
}


Please help.
Thank You
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java ME Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo