access control exception

i am currently in a java class where i am required to make a game/program using applets i am not familiar with any of the exceptions so i do not kno how to fix this runtime error. the oblect of this program is to let users import their own images into the applet and let them paint on it.I need to fix the security errors i am getting.

here is the code :

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class Draw extends JApplet implements ActionListener

{

JLabel insert = new JLabel("please insert a picture");

JTextField filename = new JTextField ("");

JButton Enter = new JButton("enter");

Button erase = new Button("erase");

DrawPanel canvas;

public void init()

{

Container con = this.getContentPane();

filename.getText();

con.add(filename);

erase.addActionListener(this);

canvas = new DrawPanel(getImage(getCodeBase()));

BorderLayout bord = new BorderLayout();

setLayout(bord);

add(canvas,"Center");

Panel commandPanel = new Panel();

commandPanel.add(erase);

add(commandPanel, "South");

}

public void actionPerformed(ActionEvent evt)

{

if(evt.getSource().equals(erase))

{

canvas.numPoints = -1;

canvas.repaint();

}

}

}

class DrawPanel extends Panel

{

Image picture;

int[] drawX = new int[1000];

int[] drawY = new int[1000];

int numPoints = -1;

DrawPanel(Image inputImage)

{

picture = inputImage;

}

public void paint(Graphics screen)

{

screen.drawImage(picture,0,0,this);

screen.setColor(Color.black);

for(int i = 0;i<= numPoints;i++)

{

screen.fillOval(drawX-3, drawY-3,6,6);

}

}

public void update(Graphics screen)

{

paint(screen);

}

public boolean mouseDown(Event evt, int x,int y)

{

if(numPoints <1000)

{

numPoints++;

drawX[numPoints] = x;

drawY[numPoints] = y;

}

repaint();

return true;

}

public boolean mouseDrag(Event evt, int x, int y)

{

mouseDown(evt, x, y);

return true;

}

}

and here are the errors:

java.security.AccessControlException: access denied (java.io.FilePermission /private/Network/Servers/mhsfile/Volumes/IQ/IQ_2006/(censored)/Documents/Adv Java/ read)

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:26 9)

at java.security.AccessController.checkPermission(AccessController.java:401)

at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)

at java.lang.SecurityManager.checkRead(SecurityManager.java:863)

at sun.awt.image.URLImageSource.<init>(URLImageSource.java:37)

at sun.applet.AppletImageRef.reconstitute(AppletImageRef.java:33)

at sun.misc.Ref.get(Ref.java:46)

at sun.applet.AppletViewer.getCachedImage(AppletViewer.java:377)

at sun.applet.AppletViewer.getImage(AppletViewer.java:372)

at java.applet.Applet.getImage(Applet.java:226)

at Draw.init(Draw.java:18)

at sun.applet.AppletPanel.run(AppletPanel.java:353)

at java.lang.Thread.run(Thread.java:552)

[3309 byte] By [baracudda0006a] at [2007-10-1 13:34:45]
# 1

i am currently in a java class where i am required to make a game/program using applets i am not familiar with any of the exceptions so i do not kno how to fix this runtime error. the oblect of this program is to let users import their own images into the applet and let them paint on it.I need to fix the security errors i am getting.

here is the code :

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

public class Draw extends JApplet implements ActionListener

{

JLabel insert = new JLabel("please insert a picture");

JTextField filename = new JTextField ("");

JButton Enter = new JButton("enter");

Button erase = new Button("erase");

DrawPanel canvas;

public void init()

{

Container con = this.getContentPane();

filename.getText();

con.add(filename);

erase.addActionListener(this);

canvas = new DrawPanel(getImage(getCodeBase()));

BorderLayout bord = new BorderLayout();

setLayout(bord);

add(canvas,"Center");

Panel commandPanel = new Panel();

commandPanel.add(erase);

add(commandPanel, "South");

}

public void actionPerformed(ActionEvent evt)

{

if(evt.getSource().equals(erase))

{

canvas.numPoints = -1;

canvas.repaint();

}

}

}

class DrawPanel extends Panel

{

Image picture;

int[] drawX = new int[1000];

int[] drawY = new int[1000];

int numPoints = -1;

DrawPanel(Image inputImage)

{

picture = inputImage;

}

public void paint(Graphics screen)

{

screen.drawImage(picture,0,0,this);

screen.setColor(Color.black);

for(int i = 0;i<= numPoints;i++)

{

screen.fillOval(drawX-3, drawY-3,6,6);

}

}

public void update(Graphics screen)

{

paint(screen);

}

public boolean mouseDown(Event evt, int x,int y)

{

if(numPoints <1000)

{

numPoints++;

drawX[numPoints] = x;

drawY[numPoints] = y;

}

repaint();

return true;

}

public boolean mouseDrag(Event evt, int x, int y)

{

mouseDown(evt, x, y);

return true;

}

}

and here are the errors:

java.security.AccessControlException: access denied (java.io.FilePermission /private/Network/Servers/mhsfile/Volumes/IQ/IQ_2006/(censored)/Documents/Adv Java/ read)

at java.security.AccessControlContext.checkPermission(AccessControlContext.java:26 9)

at java.security.AccessController.checkPermission(AccessController.java:401)

at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)

at java.lang.SecurityManager.checkRead(SecurityManager.java:863)

at sun.awt.image.URLImageSource.<init>(URLImageSource.java:37)

at sun.applet.AppletImageRef.reconstitute(AppletImageRef.java:33)

at sun.misc.Ref.get(Ref.java:46)

at sun.applet.AppletViewer.getCachedImage(AppletViewer.java:377)

at sun.applet.AppletViewer.getImage(AppletViewer.java:372)

at java.applet.Applet.getImage(Applet.java:226)

at Draw.init(Draw.java:18)

at sun.applet.AppletPanel.run(AppletPanel.java:353)

at java.lang.Thread.run(Thread.java:552)

baracudda0006a at 2007-7-10 16:34:54 > top of Java-index,Security,Other Security APIs, Tools, and Issues...