Java Reference
In-Depth Information
Solutions to
selected exercises
A
A.1
Chapter 2
A.1.1
2.1
Both windows close. The reason is that clicking the close button of a SimpleFrame
results in the command System.exit(0) . This terminates the application , i.e. the
program that contains the main -method. In our case this is SimpleFrameDriver .
As both frames are constructed there, both are terminated.
A.1.2
2.2
The present border components extend to fill the whole area.
A.2
Chapter 4
A.2.1
4.2
The following listings of the package its.Light contain a traffic light simulation
in a model-view implementation.
File: its/Light/Constants.java
1.
package its.Light;
2.
3.
4.
public class Constants {
5.
public static final int LIGHT_RED
= 1;
6.
public static final int LIGHT_RED_ORANGE = 2;
7.
public static final int LIGHT_GREEN
= 3;
8.
public static final int LIGHT_ORANGE
= 4;
9.
}
Search WWH ::




Custom Search