Reputation: 147
Is there anything wrong with doing this:
public static Image getPicture01()
{
Applet app = new Applet();
Image t = app.getImage(app.getClass().getResource("/res/pic01.png"));
return t;
}
My goal is to get a resource (image) from my project in Java, and use it.
Upvotes: 1
Views: 44
Reputation: 285403
Is there anything wrong with doing this:...
Yes, it is totally unnecessary, wasteful (creating an unneeded object, Applet), and there are better alternatives -- ImageIO.read(...) for one.
Upvotes: 3