Java Reference
In-Depth Information
25.
drawing.flipLines(); // flip them to vertical
26.
27.
}
28.
29.
public static void main(String[] args){
30.
BadUpdateFrame badFrame = new BadUpdateFrame();
31.
badFrame.showIt("Bad Update");
32.
badFrame.badDemo();
33.
}
34.
35.
36. }
This should display a sequence of three drawings. The first has three horizontal
lines, the second one three vertical ones and the third one again consists of three
horizontal lines:
What is really displayed depends on many things: the operation system, the version
of the SDK, the current load (number of processes) on the machine and many more
things. Also the behaviour might vary from one execution of the application to the
next. Most of the time one observes the following sequence of images:
For an explanation let us look at the following three lines of code in BadUpdate-
Frame :
drawing.flipLines(); // flip them to vertical
uppane.repaint(); // paint the vertical lines
drawing.flipLines(); // flip them back to horizontal
Their order suggests that after all three lines are flipped, the new drawing is dis-
played and only then are they flipped again. The problem comes from the fact that
Search WWH ::




Custom Search