Page 771 - Introduction to Programming with Java: A Problem Solving Approach
P. 771

                Figure 17.21 Four displays of a window that uses a slider to mimic an eclipse
The following code from the lunar eclipse program shows how to instantiate a slider, set properties, and
add a listener:
slider = new JSlider(SwingConstants.HORIZONTAL, 0, 100, 0);
slider.setMajorTickSpacing(5);
slider.setPaintTicks(true);
slider.addChangeListener(new Listener());
Summary 737
      slider thumb slider
{
    Apago PDF Enhancer
   























































































   769   770   771   772   773