What exactly does getValueIsAdjusting do?

As the javadoc which JB Nizet linked to states, getValueIsAdjusting() checks whether a specific event (a change) is part of a chain, if so it will return true. It will only return false when the specified event is the final one in the chain.

In your case, selecting a row by clicking actually fires two events: a mouseDown and mouseUp event and both are sent to your event listener. If you correctly implement getValueIsAdjusting() to return whenever the value is true, you will only act on the final event in the chain, which is the mouseUp event that fires when you let go of the left mouse button.

The Java Tutorials include an example that captures events, you can use that to log the selection events and experiment with it yourself. Remove the return on the event.getValueIsAdjusting() check to log every event that's fired.

Tags:

Java

Swing

Jtable