Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is only the part of the class that loads the images
- private URL getURL(String filename) {
- URL url = null;
- try {
- url = this.getClass().getResource(filename);
- //url = new java.net.URL(applet.getCodeBase() + filename);
- }
- //catch (MalformedURLException e) { e.printStackTrace(); }
- catch (Exception e) { }
- return url;
- }
- public void load(String filename) {
- Toolkit tk = Toolkit.getDefaultToolkit();
- image = tk.getImage(getURL(filename));
- while(getImage().getWidth(applet) <= 0){loaded = false;}
- double x = applet.getSize().width/2 - width()/2;
- double y = applet.getSize().height/2 - height()/2;
- at = AffineTransform.getTranslateInstance(x, y);
- loaded = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement