Lesson 11 | Student project to add "Access Control" |
Objective | Modify a Drawing Program to add access control. |
Student Project - Building Graphical User Interfaces
The project for this module is to take a working drawing program (the same one developed in the course Building Graphical User Interfaces and rework some of the classes to add access control.
Here is the drawing program you will modify.
You might want to play around with this for a minute or two to see what it's all about.
Applet enabled browser
Remember, some of the applets in this course require a JDK 1.2-enabled browser.
If an applet does not function properly in your browser, check it in the JDK 1.2 appletviewer.
Java Applet Legacy
During the past seven years (2013-2020), browser vendors have withdrawn support for plugins such as Flash, Silverlight, and Java in their products, with Microsoft Internet Explorer 11 being the only major browser still allowing them. Support for running Applets in browsers was only possible while browser vendors were committed to standards-based plugins. With that no longer being the case, Applet support ended in March 2019.
- Oracle announced in January 2016 that Applets would be deprecated in Java SE 9, and the technology was removed in Java SE 11.
- There are currently no plans to remove the components required to run Applets in Microsoft Internet Explorer 11 from Java SE 8, but they may be removed at any time with little or no warning.
- Components required to run Applets on non-Windows platforms are being removed starting July 2020.
Java Web Start and Pre-Installed Java Runtime Environments
Web Start has been included in the Oracle Java Runtime Environment (JRE) since 2001. It is launched automatically when a Java application using Web Start technology is downloaded for the first time. Desktop shortcuts can also launch the application, providing the user with a similar experience to that of a native application. Web Start has become an intermediate migration path for developers as browser vendors continued to restrict plugin support over the past several years.
Since it is predominantly a desktop technology, Web Start has some limitations. In particular, it requires a standalone JRE to be installed and maintained on the user's desktop.
However, over the past decade, vendors of the most popular desktop operating systems have emphatically pushed for applications on their platforms to be delivered bundled with integrated, sandboxed runtimes. Increasingly they require desktop applications to be distributed through their own proprietary
"app stores."
The notion of an application being distributed separately from a standalone JRE is, therefore, quickly fading. To address this changing technology landscape affecting Web Start:
- Oracle extended support for Web Start in Java SE 8 from March, 2019, through at least March 2030. This support is of course subject to any constraints imposed over time by the browser and operating system vendors as it was with Applets.
- Oracle products that have dependencies on Web Start will remain on Java SE 8 and continue with the support timelines as indicated by those products.
- Oracle does not include Web Start in Java SE 11 and later.
- Oracle has been encouraging application developers and users to transition away from Web Start and encouraging non-commercial consumers to remove any unused or non-supported Oracle JRE installations from their desktops.
- Developers who deploy desktop applications to individual consumers (eg, games, personal banking, or other B2C applications) will need to transition to other deployment technologies such as jlink, jpackage and/or third party packaging and deployment solutions as soon as possible.
- Application developers who target applications for internal data processing, business, commercial, or production purposes, will either need to seek commercial license with Oracle, or transition to other deployment technologies.
Exercise: Add access control
Begin work on the exercise by examining the
source code for the drawing program.
Please copy the code for use in the exercise that follows.
If you look at how the classes, variables, and methods are defined, you will notice that none of them use access control keywords (except for the applet, which must be defined as
public
).
Click on the link below to perform the exercise with respect to
Access Control.
Student Exercise
Once you have gotten a sense of how this program works, turn to the exercise to add
protected
and
public
keywords
to the
Shape
,
Circle
, and
Square
classes, according to the instructions.