Results 1 to 3 of 3

Thread: [RESOLVED] Draw Image (Mobile Edition)

  1. #1

    Thread Starter
    Member RaZeR's Avatar
    Join Date
    Jan 2009
    Location
    Russia, Moscow
    Posts
    38

    Resolved [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

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [RESOLVED] Draw Image (Mobile Edition)

    Some time later...
    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

  3. #3

    Thread Starter
    Member RaZeR's Avatar
    Join Date
    Jan 2009
    Location
    Russia, Moscow
    Posts
    38

    Re: [RESOLVED] Draw Image (Mobile Edition)

    Quote Originally Posted by ComputerJy View Post
    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
  •  



Click Here to Expand Forum to Full Width