getColumnIndexAtX
int getColumnIndexAtX
(int xPosition)
Returns the index of the column that lies on the horizontal point, xPosition
; or -1 if it lies outside the any of the column's bounds. In keeping with Swing's separable model architecture, a TableColumnModel does not know how the table columns actually appear on screen. The visual presentation of the columns is the responsibility of the view/controller object using this model (typically JTable). The view/controller need not display the columns sequentially from left to right. For example, columns could be displayed from right to left to accommodate a locale preference or some columns might be hidden at the request of the user. Because the model does not know how the columns are laid out on screen, the given xPosition
should not be considered to be a coordinate in 2D graphics space. Instead, it should be considered to be a width from the start of the first column in the model. If the column index for a given X coordinate in 2D space is required, JTable.columnAtPoint
can be used instead.
- Parameters:
-
xPosition
- width from the start of the first column in the model.
- Returns:
- the index of the column; or -1 if no column is found
- See Also:
-