Java Reference
In-Depth Information
62.
63.
64.
public void
showNextColors(){
65.
light.nextColor();
66.
this
.setColor(light.getCurrentColors());
67.
}
68.
}
File:
its/Light/LightListener.java
1.
package
its.Light;
2.
3.
import
java.awt.event.ActionEvent;
4.
import
java.awt.event.ActionListener;
5.
6.
public class
LightListener
implements
ActionListener {
7.
8.
private
LightFrame parentFrame;
public
LightListener(LightFrame pf) {
9.
parentFrame = pf;
10.
}
11.
12.
13.
14.
public void
actionPerformed(ActionEvent evt) {
15.
String actComm = evt.getActionCommand();
16.
if
(actComm.equals("Next")){
17.
parentFrame.showNextColors();
18.
}
19.
else
20.
{
21.
System.out.println("ILLEGAL COMMAND SOURCE");
22.
}
23.
}
24.
25.
26.
}
File:
its/Light/LightDriver.java
package
its.Light;
1.
2.
3.
public class
LightDriver {
public static void
main(String[] args) {
4.
LightModel lm =
new
LightModel();
5.
Search WWH ::
Custom Search