| Reply | « Previous Thread | Next Thread » |
|
Dear all,
I know how to program in java. but dont have much idea about J2ME. i want a quick start thats why before going through detail, i want to develop a small application which would load an image (jpg or png) on the screen. i have been trying several times and looked at several forum posts here, but unfortunately i could not b succeed yet. would you please help me providing a small piece of code and step by step instructions!!!! please please please!!! u can send email to me too (golam.kaosar@gmail.com) thanks a lot. |
| golam.kaosar |
| View Public Profile |
| Find all posts by golam.kaosar |
|
Hi golam.kaosar,
check the javax.microedition.lcdui.Image class. this is javadoc for it.... http://www.j2medev.com/api/midp/java...use/Image.html this is the way you put an image into your midlet Image b; b.createImage("image.png"); With Regards, Mitesh Manani http://getpass.netfirms.com |
|
dear,
thanks a lot for quick reply. i already saw these classes. but i tried in several ways and did not get success. now i m confused about the whole process. therefore an example program (code) would be the best remedy for this problem. if u have such example, please let me know. thanks again. |
| golam.kaosar |
| View Public Profile |
| Find all posts by golam.kaosar |
|
copy paste your part of the code so that i can make out the mistake that your making. try to do it yourself rather than getting the readymade code...
You will learn better. With Regards, Mitesh Manani http://getpass.netfirms.com |
|
here is the code:
import javax.microedition.lcdui.*; import javax.microedition.lcdui.game.*; import java.io.*; public class ImageTest extends Canvas implements Runnable{ private Image image; private int x; private int y; private TiledLayer layer; public ImageTest(String imageName) throws ApplicationException { try{ image=Image.createImage("/image1.png"); layer=new TiledLayer(7,7,image,20,20); x=(getWidth()-layer.getHeight())/2; y=(getHeight()-layer.getWidth())/2; layer.setPosition(x,y); }catch (IOException e){ throw new Exception("Unable to create Image"); } } public void paint(Graphics g){ layer.paint(g); } public void run(){ int n=0; while(n<=21){ for(int i=0;i<7;i++){ for(int j=0;j<7;j++){ layer.setCell(i,j,(i+1)+n+(j*28)); } } repaint(); try{ Thread.sleep(100); }catch(InterruptedException ie){} n++; } } } here the constructor has an argument. i dont know when and how the argument should be sent. also i dont know where the image file should be located. if i run this program following error occurs: Project "ImageTest" loaded Project settings saved Building "ImageTest" C:\java\WTK\apps\ImageTest\src\ImageTest.java:10: cannot find symbol symbol : class ApplicationException location: class ImageTest throws ApplicationException { ^ 1 error com.sun.kvem.ktools.ExecutionException Build failed i am using java wireless toolkit i really appreciate and thank you for your kind and prompt reply. |
| golam.kaosar |
| View Public Profile |
| Find all posts by golam.kaosar |
|
your error isnt related to loading an image nor even to j2me
if u know java then it should be easy for u it says it cant find the class ApplicationException u declare the constructor to throw "ApplicationException" which is not a class or not in the src folder or the class-path i think u ment "throws Exception" since later on u do throw an Exception and nothing else p.s STOP SPAMMING your problem on all open threads thread jacking is not nice or will help u open one thread and wait for assistance |
|
can u please give me a piece of code which would load an image file as the background of the application?
thanks |
| golam.kaosar |
| View Public Profile |
| Find all posts by golam.kaosar |
|
make sure all the images are in the res folder of your toolkit.
With Regards, Mitesh Manani http://getpass.netfirms.com |
|
yes the image is there. i tried with the full path name too. i appreciate ur help. can i get your email address so that we could have more prompt communication.
thanks a lot |
| golam.kaosar |
| View Public Profile |
| Find all posts by golam.kaosar |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| load multiple images using 1 CFbsBitmap variable result in same image | Rx-lee | General Symbian C++ | 1 | 2006-11-15 08:03 |
| Load image from MBM file | palak_shah_23 | Symbian User Interface | 17 | 2006-11-04 14:36 |
| How to load application in N80? | shiloliu | Mobile Java Networking & Messaging & Security | 1 | 2006-08-09 12:19 |
| Can I install my application software into an image phone? | huangtx2004 | General Discussion | 3 | 2004-08-23 05:41 |
| Nokia Image Converter | davidpurdie | General Discussion | 0 | 2004-02-18 16:31 |