HTML gevorderde |
|
Hey, ik doe ergens iets verkeerd met het inlezen van een image, want ik krijg deze error
java.security.AccessControlException: access denied (java.io.FilePermission TBird.gif read)
java.security.AccessControlException: access denied (java.io.FilePermission TBird.gif read)
, terwijl ik wel de lees- en uitvoerproperties op ge-accepteerd heb staan....
...
public void update(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
bird = createImage("TBird.gif");
g2.drawImage(bird, mod.getX(), mod.getY(), this);
}
private BufferedImage createImage(String file)
{
Image image1 = Toolkit.getDefaultToolkit().getImage(file);
try
{
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image1, 0);
tracker.waitForID(0);
}
catch(Exception e)
{
System.out.println("createimage");
}
BufferedImage bi = new BufferedImage(70, 70, BufferedImage.TYPE_INT_RGB);
Graphics2D big = bi.createGraphics();
big.drawImage(image1,0,0,70,70,null,this);
return bi;
}
...
... public void update(Graphics g) { Graphics2D g2 = (Graphics2D) g; bird = createImage("TBird.gif"); g2.drawImage(bird, mod.getX(), mod.getY(), this); } private BufferedImage createImage (String file) { Image image1 = Toolkit .getDefaultToolkit ().getImage (file); try { MediaTracker tracker = new MediaTracker(this); tracker.addImage(image1, 0); tracker.waitForID(0); } catch(Exception e) { System.out .println ("createimage"); } BufferedImage bi = new BufferedImage(70, 70, BufferedImage.TYPE_INT_RGB); Graphics2D big = bi.createGraphics(); big.drawImage(image1,0,0,70,70,null,this); return bi; } ...
|