Cell validation in JTable

前端 未结 2 1782
梦谈多话
梦谈多话 2020-12-11 07:05

I have a JTable that needs cell validation for the cells where the user can input text. When a user enters invalid text the border of the cell turns red.

I\'ve manag

2条回答
  •  醉酒成梦
    2020-12-11 07:41

    Also consider a custom TableCellEditor, seen here and below. Adding an InputVerifier, as shown here, is a good alternative.

    As the user must be able to reorder the table by column:

    JTable provides methods that convert from model coordinates to view coordinates — convertColumnIndexToView and convertRowIndexToView — and that convert from view coordinates to model coordinates — convertColumnIndexToModel and convertRowIndexToModel.

    image

提交回复
热议问题