bombboyer
asked on
Putting a JPEG in a JFrame form
I've written a basic JFrame form, and I want to put a small JPEG image on/in it to "jazz it up". How?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can load the image using the Toolkit getImage method.
Image i = Toolkit.getDefaultToolkit( ).getImage (imageurl) ;
Java doesn't produce an exe (though there are 3rd party products that provide varying levels of support for generating an exe, but thats a different story), you will need to distrubute the image with you program. You can get the url from your application jar (or classpath) for the image using:
URL imageurl = getClass().getResource(ima gename);
Image i = Toolkit.getDefaultToolkit(
Java doesn't produce an exe (though there are 3rd party products that provide varying levels of support for generating an exe, but thats a different story), you will need to distrubute the image with you program. You can get the url from your application jar (or classpath) for the image using:
URL imageurl = getClass().getResource(ima
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
-- Split between objects and CEHJ
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TimYates
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
-- Split between objects and CEHJ
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
TimYates
EE Cleanup Volunteer
ASKER