本文整理匯總了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;
}