本文整理了Java中javax.swing.JTree.getPathBounds()
方法的一些代码示例,展示了JTree.getPathBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.getPathBounds()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:getPathBounds
暂无
代码示例来源:origin: zzz40500/GsonFormat
@Override
public void mouseClicked(MouseEvent me) {
TreePath path = tree.getPathForLocation(me.getX(), me.getY());
if (path == null) {
return;
}
if (me.getX() > tree.getPathBounds(path).x + hotspot) {
return;
}
boolean selected = selectionModel.isPathSelected(path, true);
selectionModel.removeTreeSelectionListener(this);
try {
if (selected) {
selectionModel.removeSelectionPath(path);
} else {
selectionModel.addSelectionPath(path);
}
} finally {
selectionModel.addTreeSelectionListener(this);
treetable.repaint();
}
}
代码示例来源:origin: ron190/jsql-injection
@Override
public boolean imageUpdate(Image img, int flags, int x, int y, int w, int h) {
if ((flags & (FRAMEBITS | ALLBITS)) != 0) {
Rectangle rect = this.tree.getPathBounds(this.path);
if (rect != null) {
this.tree.repaint(rect);
}
}
return (flags & (ALLBITS | ABORT)) == 0;
}
代码示例来源:origin: abbot/abbot
@Override
public Rectangle call() {
return tree.getPathBounds(matchingPath);
}
});
代码示例来源:origin: stackoverflow.com
if(me.getX()/1.2>tree.getPathBounds(path).x+hotspot)
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
private boolean checkContinueTimer (Point p) {
Rectangle r = tree.getPathBounds(tree.getSelectionPath ());
if (r == null) return false;
return (r.contains (p));
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
private boolean checkContinueTimer(Point p) {
Rectangle r = tree.getPathBounds(tree.getSelectionPath());
if (r == null) {
return false;
}
return (r.contains(p));
}
代码示例来源:origin: javax.help/javahelp
private static Rectangle getRectangleAt(JTree tree, int x, int y) {
Rectangle rect = null;
try {
TreePath path = tree.getPathForLocation(x, y);
rect = tree.getPathBounds(path);
} catch (Exception e) {
}
return rect;
}
代码示例来源:origin: org.nuiton/nuiton-widgets
public Rectangle getCellBounds() {
TreePath treePath = tree.getPathForRow(rowIndex);
Rectangle cellRect = tree.getPathBounds(treePath);
return cellRect;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
/** Make a path visible.
* @param path the path
*/
private void showPathWithoutExpansion (TreePath path) {
Rectangle rect = tree.getPathBounds(path);
if (rect != null) { //PENDING
tree.scrollRectToVisible(rect);
}
}
代码示例来源:origin: raydac/netbeans-mmd-plugin
public void redraw() {
final Rectangle rect = this.tree.getPathBounds(this.path);
if (rect != null) {
this.tree.repaint(rect);
}
}
}
代码示例来源:origin: net.sf.jt400/jt400
public VObject getObjectAt (Point point)
{
VObject object = null;
TreePath treePath = tree_.getClosestPathForLocation (point.x, point.y);
Rectangle pathBounds = tree_.getPathBounds (treePath);
if (pathBounds.contains (point))
object = (VObject) treePath.getLastPathComponent ();
return object;
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
/** Make a path visible.
* @param path the path
*/
private void showPathWithoutExpansion (TreePath path) {
Rectangle rect = tree.getPathBounds(path);
if (rect != null) { //PENDING
tree.scrollRectToVisible(rect);
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
private boolean checkContinueTimer (Point p) {
Rectangle r = tree.getPathBounds(tree.getSelectionPath ());
if (r == null) return false;
return (r.contains (p));
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
void scrollTreeToVisible(TreePath path, TreeNode child) {
Rectangle base = tree.getVisibleRect();
Rectangle b1 = tree.getPathBounds(path);
Rectangle b2 = tree.getPathBounds(new TreePath(treeModel.getPathToRoot(child)));
if ((base != null) && (b1 != null) && (b2 != null)) {
tree.scrollRectToVisible(new Rectangle(base.x, b1.y, 1, b2.y - b1.y + b2.height));
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
void scrollTreeToVisible(TreePath path, TreeNode child) {
Rectangle base = tree.getVisibleRect();
Rectangle b1 = tree.getPathBounds(path);
Rectangle b2 = tree.getPathBounds(new TreePath(treeModel.getPathToRoot(child)));
if (base != null && b1 != null && b2 != null) {
tree.scrollRectToVisible(new Rectangle(base.x, b1.y, 1, b2.y - b1.y + b2.height));
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
void scrollTreeToVisible(TreePath path, TreeNode child) {
Rectangle base = tree.getVisibleRect();
Rectangle b1 = tree.getPathBounds(path);
Rectangle b2 = tree.getPathBounds(new TreePath(treeModel.getPathToRoot(child)));
if (base != null && b1 != null && b2 != null) {
tree.scrollRectToVisible(new Rectangle(base.x, b1.y, 1, b2.y - b1.y + b2.height));
}
}
代码示例来源:origin: aterai/java-swing-tips
@Override public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) {
if (!tree.isShowing()) {
return false;
}
Rectangle cellRect = tree.getPathBounds(path);
if ((infoflags & (FRAMEBITS | ALLBITS)) != 0 && Objects.nonNull(cellRect)) {
tree.repaint(cellRect);
}
return (infoflags & (ALLBITS | ABORT)) == 0;
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-java-hints-analyzer
private void showPathWithoutExpansion(TreePath path) {
Rectangle rect = tree.getPathBounds(path);
if (rect != null && getWidth() > 0 && getHeight() > 0 ) {
tree.scrollRectToVisible(rect);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-modelutil
private void showPathWithoutExpansion(TreePath path) {
Rectangle rect = tree.getPathBounds(path);
if (rect != null && getWidth() > 0 && getHeight() > 0) {
tree.scrollRectToVisible(rect);
}
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
/** Expand the given path and makes it visible.
* @param path the path
*/
protected void showPath(TreePath path) {
tree.makeVisible(path);
Rectangle rect = tree.getPathBounds(path);
if (rect != null) {
rect.width += rect.x;
rect.x = 0;
tree.scrollRectToVisible(rect);
}
tree.setSelectionPath(path);
}
内容来源于网络,如有侵权,请联系作者删除!