Java Reference
In-Depth Information
SOLUTION 9.4
A solution is:
public JSlider slider()
{
if (slider == null)
{
slider = new JSlider();
sliderMax = slider.getMaximum();
sliderMin = slider.getMinimum();
slider.addChangeListener
(
new ChangeListener()
{
public void stateChanged(ChangeEvent e) {
tPeak.setValue(
(slider.getValue() - sliderMin)
/ (sliderMax - sliderMin));
}
}
);
slider.setValue(slider.getMinimum());
}
return slider;
}
SOLUTION 9.5
Figure B.10 shows the calls that flow when a user moves the slider in the ballistics
application.
Figure B.10. MVC causes the path of change to loop through a business layer.
Search WWH ::




Custom Search