|
-
Aug 16th, 2009, 01:29 PM
#1
Thread Starter
Member
[RESOLVED] Draw Image (Mobile Edition)
Hi 
I have started learning Java for mobile, i have make some simple programs (ReverseText, Calculator, BoxMove, DiscoLight), and now i want to create simple game.
I'm need to draw image on canvas, in paint(Graphics g) void. I have tested g.drawImage, but it says that i using a null pointer 
How to initialize Image object and draw that to canvas? 
Some time later...
Okay, i fixed it! 
Code:
g.drawImage(Image.createImage("/redball.png"),0 , 0, Graphics.TOP | Graphics.LEFT);
Last edited by RaZeR; Aug 16th, 2009 at 01:51 PM.
VB 6, VB.NET, C#, Java, JavaME, C/C++ and Assembler Programmer

If my post was helpful, rate me 
-
Aug 17th, 2009, 01:12 AM
#2
Re: [RESOLVED] Draw Image (Mobile Edition)
And both the security manager and the garbage collector lived happily ever after
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Aug 20th, 2009, 11:41 AM
#3
Thread Starter
Member
Re: [RESOLVED] Draw Image (Mobile Edition)
 Originally Posted by ComputerJy
And both the security manager and the garbage collector lived happily ever after 
Haha, cool joke 
How to declare image? Maybe just write
Code:
private Image testImg = Image.createImage("/sample.png");
Will this generate "Null pointer" errors?
VB 6, VB.NET, C#, Java, JavaME, C/C++ and Assembler Programmer

If my post was helpful, rate me 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|