您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)

 

Apply Index

Apply Page # 7

Exercise 1 — Why are graphics ‘volatile’?

A Java program must be able to re-draw its display completely whenever it is asked to do so. It is a common mistakes made by novice programmers that the program looks fine when it is first executed, but as time goes by bits of the display start to disappear. This happens because the programmer has not provided the facilities to re-draw the display on demand.

This seems a very complicated way of going about things. After all, the Java system ‘knows' when each component needs to be re-drawn; why can't it just ‘remember' what is displayed in each component and display it when required? In addition, it takes time for the Java program to re-draw the screen, and if it does so unnecessarily this is very inefficient.

In fact there is a very good reason for Java to work this way. What would be the problem with the Java system ‘remembering' the contents of each component, and redrawing them automatically?

Discussion of Exercise 1
Back to Content

Back to top

basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg