Link to home
Start Free TrialLog in
Avatar of babytoy
babytoy

asked on

loading an image

ive been having this problem for 2 days already.. ive been surfing the net and reading books but with no prevail i still dont know or any idea what to do with this problem.. what am i doing wrong? ive been having a NullPointerException pointing to here : setup.setImage(Toolkit.getDefaultToolkit().getImage("mpix/rmstudio.gif") ); setup is an instance of my JFrame with an attribute of Image so i could draw the image on my jframe.. this line -> setup.setImage(Toolkit.getDefaultToolkit().getImage("mpix/rmstudio.gif") ); is located on another class called Tools.. then calling setup.repaint()..i wanted to insert the image on the jframe by clicking on a jbutton ( which has the setup.setImage(Toolkit.getDefaultToolkit().getImage("mpix/rmstudio.gif") ); .. is the problem really pointing here?

Any help would be appreciated.
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of babytoy
babytoy

ASKER

but by using ImageIcon, would i able to put a running image on top of it? because it is like a map (of something like this Image[14][10]) where another image (more specifically a person running on the map) runs on top of it. is that possible?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of babytoy

ASKER

by using this i still get a NullPointerException but it is now pointing to the line where i added the myImageLabel to the contentpane of JFrame.
Avatar of babytoy

ASKER

oh i see. ill look on to that first. thanks
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of babytoy

ASKER

A friend told me that i was passing an instance that doesn't exist.  That's why its prompting a NullPointerException.  what i need now is to load the images faster.  Fortunately there's a suggestion above.  =) Lastly, Thank you all for your kindness.  =) i really appreciate it.
8-) Incidentally, the image doesn't need to be in a jar to load as i mentioned