本文整理汇总了Java中com.intellij.ui.treeStructure.Tree.getPathForLocation方法的典型用法代码示例。如果您正苦于以下问题:Java Tree.getPathForLocation方法的具体用法?Java Tree.getPathForLocation怎么用?Java Tree.getPathForLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.treeStructure.Tree
的用法示例。
在下文中一共展示了Tree.getPathForLocation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDragImage
import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private static Pair<Image, Point> createDragImage(final Tree tree, final Component c, Point dragOrigin, boolean adjustToPathUnderDragOrigin) {
if (c instanceof JComponent) {
((JComponent)c).setOpaque(true);
}
c.setForeground(tree.getForeground());
c.setBackground(tree.getBackground());
c.setFont(tree.getFont());
c.setSize(c.getPreferredSize());
final BufferedImage image = UIUtil.createImage(c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = (Graphics2D)image.getGraphics();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
c.paint(g2);
g2.dispose();
Point point = new Point(-image.getWidth(null) / 2, -image.getHeight(null) / 2);
if (adjustToPathUnderDragOrigin) {
TreePath path = tree.getPathForLocation(dragOrigin.x, dragOrigin.y);
if (path != null) {
Rectangle bounds = tree.getPathBounds(path);
point = new Point(bounds.x - dragOrigin.x, bounds.y - dragOrigin.y);
}
}
return new Pair<Image, Point>(image, point);
}