910 |
*/ |
*/ |
911 |
public int columnAtPoint(Point point) |
public int columnAtPoint(Point point) |
912 |
{ |
{ |
913 |
int x0 = getLocation().x; |
if (point != null) |
|
int ncols = getColumnCount(); |
|
|
Dimension gap = getIntercellSpacing(); |
|
|
TableColumnModel cols = getColumnModel(); |
|
|
int x = point.x; |
|
|
|
|
|
for (int i = 0; i < ncols; ++i) |
|
914 |
{ |
{ |
915 |
int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : gap.width); |
int x0 = getLocation().x; |
916 |
if (0 <= x && x < width) |
int ncols = getColumnCount(); |
917 |
return i; |
Dimension gap = getIntercellSpacing(); |
918 |
x -= width; |
TableColumnModel cols = getColumnModel(); |
919 |
|
int x = point.x; |
920 |
|
|
921 |
|
for (int i = 0; i < ncols; ++i) |
922 |
|
{ |
923 |
|
int width = cols.getColumn(i).getWidth() |
924 |
|
+ (gap == null ? 0 : gap.width); |
925 |
|
if (0 <= x && x < width) |
926 |
|
return i; |
927 |
|
x -= width; |
928 |
|
} |
929 |
} |
} |
|
|
|
930 |
return -1; |
return -1; |
931 |
} |
} |
932 |
|
|
940 |
*/ |
*/ |
941 |
public int rowAtPoint(Point point) |
public int rowAtPoint(Point point) |
942 |
{ |
{ |
943 |
int y0 = getLocation().y; |
if (point != null) |
|
int nrows = getRowCount(); |
|
|
Dimension gap = getIntercellSpacing(); |
|
|
int height = getRowHeight() + (gap == null ? 0 : gap.height); |
|
|
int y = point.y; |
|
|
|
|
|
for (int i = 0; i < nrows; ++i) |
|
944 |
{ |
{ |
945 |
if (0 <= y && y < height) |
int y0 = getLocation().y; |
946 |
return i; |
int nrows = getRowCount(); |
947 |
y -= height; |
Dimension gap = getIntercellSpacing(); |
948 |
|
int height = getRowHeight() + (gap == null ? 0 : gap.height); |
949 |
|
int y = point.y; |
950 |
|
|
951 |
|
for (int i = 0; i < nrows; ++i) |
952 |
|
{ |
953 |
|
if (0 <= y && y < height) |
954 |
|
return i; |
955 |
|
y -= height; |
956 |
|
} |
957 |
} |
} |
|
|
|
958 |
return -1; |
return -1; |
959 |
} |
} |
960 |
|
|