In the example the property HorizontalAlignment is a regular int value, but in the context of Swing components only a few numbers are valid. The example demonstrates how to install and use a customized TableCellEditor to validate user input - invalid values will not be accepted.

All relevant lines are highlighted. Press the "Run..." button to start the demo.