本文整理汇总了Java中javax.swing.table.JTableHeader.getHeaderRect方法的典型用法代码示例。如果您正苦于以下问题:Java JTableHeader.getHeaderRect方法的具体用法?Java JTableHeader.getHeaderRect怎么用?Java JTableHeader.getHeaderRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.JTableHeader
的用法示例。
在下文中一共展示了JTableHeader.getHeaderRect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResizingColumn
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
private TableColumn getResizingColumn(JTableHeader header, Point p, int column) {
if (column == -1) {
return null;
}
Rectangle r = header.getHeaderRect(column);
r.grow(-3, 0);
if (r.contains(p)) {
return null;
}
int midPoint = r.x + r.width / 2;
int columnIndex = 0;
if (header.getComponentOrientation().isLeftToRight()) {
columnIndex = (p.x < midPoint) ? column - 1 : column;
} else {
columnIndex = (p.x < midPoint) ? column : column - 1;
}
if (columnIndex == -1) {
return null;
}
return header.getColumnModel().getColumn(columnIndex);
}
示例2: getResizingColumn
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
final private TableColumn getResizingColumn(JTableHeader objLjTableHeader, Point objPoint, int intPcolumnIndex) {
if (intPcolumnIndex == -1) {
return null;
}
final Rectangle objLrectangle = objLjTableHeader.getHeaderRect(intPcolumnIndex);
objLrectangle.grow(-3, 0);
if (objLrectangle.contains(objPoint)) {
return null;
}
final int intLmiddlePoint = objLrectangle.x + objLrectangle.width / 2;
int intLcolumnIndex = Constants.bytS_UNCLASS_NO_VALUE;
if (objLjTableHeader.getComponentOrientation().isLeftToRight()) {
intLcolumnIndex = objPoint.x < intLmiddlePoint ? intPcolumnIndex - 1 : intPcolumnIndex;
} else {
intLcolumnIndex = objPoint.x < intLmiddlePoint ? intPcolumnIndex : intPcolumnIndex - 1;
}
if (intLcolumnIndex == Constants.bytS_UNCLASS_NO_VALUE) {
return null;
}
return objLjTableHeader.getColumnModel().getColumn(intLcolumnIndex);
}
示例3: clickOnSecondHeader
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
/**
* Clicks on "<<" column header.
*/
protected void clickOnSecondHeader() {
JTableHeader header = treeTable().getTableHeader();
Rectangle rect = header.getHeaderRect(1);
new ComponentOperator(header).clickMouse(rect.x + rect.width/2,
rect.y + rect.height/2,
1);
}
示例4: getSortingColumnIndex
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
private int getSortingColumnIndex(JTableHeader header, Point p, int column) {
if (column == -1) {
return -1;
}
Rectangle r = header.getHeaderRect(column);
r.grow(-4, 0);
if (!r.contains(p)) {
return -1;
} else {
return column;
}
}
示例5: getMinWidth
import javax.swing.table.JTableHeader; //导入方法依赖的package包/类
public int getMinWidth (JTableHeader header, int col) {
return header.getHeaderRect (col).width;
}