NetBeans Forums

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

Image.createImage exception

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



Joined: 24 Apr 2013
Posts: 4

PostPosted: Wed Apr 24, 2013 6:54 pm    Post subject: Image.createImage exception Reply with quote

Hi all, I have problem with loading image to my application. If I create image with method
Code:
Image.createImage(String name)
everything is ok, but when I want to use just part of this image and when I call method
Code:
Image.createImage(Image image, int x, int y, int width, int height, int transform)
the Exception is thrown.

Part of my code:
- works correct:
Code:

try {
    String name = "name.png";
    Image img = Image.createImage(name);

    g.drawImage(img, imageX, imageY, 0);
} catch (IOException ioex) {
    System.err.println(ioex);
}


- throws Exception:
Code:

try {
    String name = "name.png";
    Image img = Image.createImage(name);

    img = Image.createImage(img, 0, 0, img.getWidth(), img.getWidth(), Sprite.TRANS_NONE);

    g.drawImage(img, imageX, imageY, 0);
} catch (IOException ioex) {
    System.err.println(ioex);
} catch (IllegalArgumentException iaex) {
    System.err.println(iaex);
}


Any idea why it is wrong? Thank you.
Back to top
fbimage



Joined: 14 Jun 2013
Posts: 3

PostPosted: Fri Jun 14, 2013 3:15 am    Post subject: Reply with quote

it is strange for that to happen. i can't see what's wrong. a little help here.
Back to top
fbimage



Joined: 14 Jun 2013
Posts: 3

PostPosted: Tue Jul 02, 2013 10:26 am    Post subject: Reply with quote

i have found some codes concerning aboutload image from file vb.net, i hope it help you.
Back to top
hongdida



Joined: 04 Jun 2013
Posts: 10

PostPosted: Tue Mar 25, 2014 7:53 am    Post subject: Re: Image.createImage exception Reply with quote

pustofkj wrote:
Hi all, I have problem with loading image to my application. If I create image with method
Code:
Image.createImage(String name)
everything is ok, but when I want to use just part of this image and when I call method


What about using BufferedImage instead of createImage()? Question
Back to top
arronlee



Joined: 26 Feb 2014
Posts: 5

PostPosted: Tue Apr 01, 2014 3:39 am    Post subject: Reply with quote

fbimage wrote:
i have found some codes......i hope it help you.

Hi, fbimage.
I think loading images is not as convenient as creating images. And I am using another
imaging toolkit instead of BufferedImage or createImage. You can alsogoogle it and find out the related tutorials about the imaging programs. Do as the guide pages. I hope you success. Good luck.



Best regards,
Arron
Back to top
priya465



Joined: 17 Aug 2017
Posts: 28

PostPosted: Tue Sep 26, 2017 7:21 am    Post subject: Reply with quote

I'm not sure. But can you give the size of the image without creating it and the code does not understand.

eg
img = Image.createImage (img, 0, 0, 26, 364, Sprite.TRANS_NONE);
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 cannot 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