Find the error(s) in the following code, which should handle the event that occurs when the value in itemsJSpinner changes.

```
1 itemsJSpinner.addChangeListener(
2
3 new ChangeListener() // anonymous inner class
4 {
5 // event handler called when value in itemsJSpinner is changed
6 public void valueChanged( ChangeEvent event )
7 {
8 itemsJSpinnerValueChanged( event );
9 }
10
11 } // end anonymous inner class
12
13 ); // end call to addChangeListener
```


The event handler must be named stateChanged. Note: The programmer-declared method should also be changed to be named itemsJSpinnerStateChanged to follow our naming guidelines.

```
1 itemsJSpinner.addChangeListener(
2
3 new ChangeListener() // anonymous inner class
4 {
5 // event handler called when value in itemsJSpinner is changed
6 public void stateChanged( ChangeEvent event )
7 {
8 itemsJSpinnerStateChanged( event );
9 }
10
11 } // end anonymous inner class
12
13 ); // end call to addChangeListener
```

Computer Science & Information Technology

You might also like to view...

Write a single C++ statement to accomplish each of the following (assume that neither using declarations nor a using directive have been used):

Declare the variables c, thisIsAVariable, q76354 and number to be of type int (in one statement) and initialize each to 0.b) Prompt the user to enter an integer. End your prompting message with a colon (:) fol- lowed by a space and leave the cursor positioned after the space.

Computer Science & Information Technology

What is the value of sodapop after the following statements?

``` var sodapop = 47.33; sodapop = Math.round(sodapop + 0.4); ``` a. true b. false c. 47 d. 48

Computer Science & Information Technology

From where does the Current Layer sampling option sample the artwork?

A. only on the top layer B. any untargeted layer C. all layers D. only on the targeted layer

Computer Science & Information Technology

The ________ option in the Find and Replace dialog box replaces only the highlighted occurrence of the search string

A) Find Next B) Find All C) Replace D) Replace All

Computer Science & Information Technology