480 Chapter 14
Figure 14.11 shows the HelloSwingApplet being displayed by the appletviewer tool.
When you are developing applets, it is common to view them in a Web browser, change a few things, recompile the applet, and go back and view your changes in the browser. You will soon find out that refreshing the Web page in the browser may or may not reload the applet class. I have noticed this with Internet Explorer using the Java plug-in while I was writing the applets for this chapter.
Applets that are downloaded and executed in a Web browser must adhere to the following rules:
■■ An applet cannot access any files on a user’s operating system.
permission to access files on your local hard drive. Of course, you will
want to make sure you trust the source of the applet before granting such
This is the typical way to create an applet that needs to perform tasks
outside the sandbox because it provides the user of the applet with some
Classroom Q & A
Q: How does the sandbox enforce these rules?
Q: Can I turn off the security permissions so my own applets can run on my machine and perform actions such as accessing the local file system?
To view and/or change the sandbox security settings for applets running in your Web browser, perform the following steps:
1. Open the Internet Options dialog box found on the Tools menu of Inter-net Explorer. (Older versions of Internet Explorer have the Internet Options on the View menu.)
484 Chapter 14
Figure 14.14 Use this dialog box to change the sandbox security settings for applets.