go to previous page   go to home page   go to next page

Answer:

Many; the exact number depends on how fast the knob is moved.

getValueIsAdjusting()

In the previous application the number in the text box changes continuously as the knob is moved. Usually this is desirable. But sometimes the application calls for a great deal of work and you don't want to do it for each change event. There are (potentially) hundreds of change events generated in moving the knob from one value to the next. While the value is still changing the listener should discard the event.

boolean getValueIsAdjusting()

This method returns true while the knob is still moving.

QUESTION 13:

Fill in the blank so that the following fragment changes the text field only after the knob has stopped.

source = (JSlider)evt.getSource() ;

if ( __source.__________ )
{
  if ( source.getName()().equals("sliderA") )
    textA.setText( source.getValue() + " " );
  if ( source.getName()().equals("sliderB") )
    textB.setText( source.getValue() + " " );
}