| |
This page contains Java programs that each try to demonstrate some feature of Java that is not often emphasized in textbooks. Most of these programs are written as Java 1.1 applets, so that they can be viewed by a browser, but most of the features demonstrated are also in Java 1.2. For each example there is a link to the Java source and (when appropriate) a link to an HTML file that will run the program. Most of these example are very short; each one is only trying to demonstrate one specific feature. For a description of each program, look at the comments at the beginning of the source files.
| |
- 1) LinesSimpleMinded.java,
LinesSimpleMinded.html.
- Shows that there is more than you might think to drawing a line.
- 2) LinesAntiAliasing.java,
LinesAntiAliasing.html.
- Shows the affect of turning line antialiasing on or off. (It seems that applets are not allowed by the security model to turn on antialiasing in a browser so you will have to view this using the appletviewer program from the JDK.)
- 3) AppletLifeCycle.java,
AppletLifeCycle.html.
- Demonstrates the order that applet methods are called in.
- 4) ClippingDemo.java,
ClippingDemo.html.
- Shows how clipping regions are used for screen refreshing.
- 5) UpdateDemoAWT.java,
UpdateDemoAWT.html.
- 6) UpdateDemoAWTSwing.java.
- These two programs show that the update() method works
differently in the AWT and in Swing.
- 7) RedrawingDemo1.java,
RedrawingDemo1.html.
- Demonstrates a very poor, but simple, way for a program to refresh a graphics window.
- 8) RedrawingDemo2.java,
RedrawingDemo2.html.
- Demonstrates the use of clipping regions to get a better way for a program to refresh a graphics window.
- 9) RedrawingDemo3.java,
RedrawingDemo3.html.
- Demonstrates the use of an off screen image as a better way for a program to refresh a graphics window.
- 10) RedrawingDemo4.java,
RedrawingDemo4.html.
- Demonstrates another way to use an off screen image as a way to refresh a graphics window.
- 11) OnScreenOffScreen.java,
OnScreenOffScreen.html.
- A side by side comparison of an on screen and an off screen graphics context.
- 12) RepaintUpdatePaint.java,
RepaintUpdatePaint.html.
- Shows that calls to repaint() do not always lead immediately to calls to paint(). Also shows that events can sometimes get lost.
- 13) PolymorphismAndOverloading.java,
PolymorphismAndOverloading.html.
- Shows how polymorphism and overloading interact.
- 14) PointSeven.java,
PointSeven.html.
- Shows how easy it is for round off errors to enter a calculation.
|
|
|
|