Hi,
Thanks for ur reply, but that is what I was tryin to do. The code below is used in the dragGestureRecognized() method:
JTree tree = (JTree)event.getComponent();
Point point = event.getDragOrigin();
//TreePath path = tree.getPathForLocation(toInt(point.getX()), toInt(point.getY()));
TreePath path = tree.getLeadSelectionPath();
Rectangle recPath = tree.getPathBounds(path);
Point pt = new Point();
pt.setLocation(toInt(point.getX())- toInt (recPath.getY()), toInt(point.getY())- toInt(recPath.getY()) );
System.out.println("dragGestureRecognized() ******************** 1");
// Get the tree cell renderer
JLabel jLabel = (JLabel) tree.getCellRenderer().getTreeCellRendererComponent
(
tree,
path.getLastPathComponent(),
false,
tree.isExpanded(path),
tree.getModel().isLeaf (path.getLastPathComponent()),
0,
false
);
jLabel.setSize((int)recPath.getWidth(), (int)recPath.getHeight());
System.out.println("dragGestureRecognized() ******************** 2");
// Get the ghostly image
BufferedImage bufImage = new BufferedImage
(
(int)recPath.getWidth(), (int)recPath.getHeight(),
BufferedImage.TYPE_INT_ARGB_PRE);
System.out.println("dragGestureRecognized() ******************** 3");
Graphics2D g2 = bufImage.createGraphics();
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC, 0.5f));
jLabel.paint(g2);
System.out.println("dragGestureRecognized() ******************** 4");
//event.startDrag(DragSource.DefaultCopyDrop, new TransferWrap(path), this);
Appreciate ur input.
Thanks,
Hetal Seth