This exception is thrown by the AccessController to indicate that a requested access (to a critical system resource such as the file system or the network) is denied.
The reason to deny access can vary. For example, the requested permission might be of an incorrect type, contain an invalid value, or request access that is not allowed according to the security policy. Such information should be given whenever possible at the time the exception is thrown.
System.setSecurityManager (new SecurityManager());
System.getSecurityManager().checkRead ("hitbuttB.gif");
Thread thread = new Thread(){ public void run(){
try {
final String[] id = {"B","R","T","L","CC","C"};
int i;
for (i = 0; i<6; i++) {
//MediaTracker m = new MediaTracker(this);
InputStream is = getClass().getResourceAsStream("hitbutt"+id[i]+".gif");
BufferedInputStream bis = new BufferedInputStream(is);
byte[] byBuf = new byte[10000]; // a buffer large enough for largest image
//
// can be
// byte[] byBuf = new byte[is.available()];
// ? is.read(byBuf); or something like that...
//lookup is/bis .read details
int byteRead = bis.read(byBuf,0,10000);
Image pic = Toolkit.getDefaultToolkit().createImage(byBuf);
//m.addImage(pic, 0);
//m.waitForAll();
hit[i] = new ImageIcon(pic);
}
}
catch(Exception e) {e.printStackTrace();}
repaint();
}}; thread.start();