Java 8 DropTargetContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DropTargetContext class.

This code example shows how to use the following methods:getComponent
	} 
 
	private AbstractDefineComponent getNodeForEvent(DropTargetDragEvent dtde) {
		Point p = dtde.getLocation();
		DropTargetContext dtc = dtde.getDropTargetContext();
		JTree tree = (JTree) dtc.getComponent();
		TreePath path = tree.getClosestPathForLocation(p.x, p.y);
		return (AbstractDefineComponent) path.getLastPathComponent();
	} 
 
	@Override 
	public void dragEnter(DropTargetDragEvent arg) {
 
		try { 
			Point p = arg.getLocation();
			TreePath path = tree.getPathForLocation(p.x, p.y);
			AnalyzedModuleComponent check = (AnalyzedModuleComponent) path
					.getLastPathComponent();
			String type = check.getType().toLowerCase();
			if (type.equals("root") || type.equals("application")
4
CodeRank
This code example shows how to use the following methods:getComponent
    } 
 
    public void dragEnter(DropTargetDragEvent e) {
        DataFlavor[] flavors = e.getCurrentDataFlavors();
        DropTargetContext ctx = e.getDropTargetContext();
        JComponent c = (JComponent)ctx.getComponent();
        LimeTransferHandler handler = (LimeTransferHandler)c.getTransferHandler();
        DropDragInfo ddi = new DropDragInfo(e);
         
        if(handler != null && handler.canImport(c, flavors, ddi) && actionSupported(ddi.action))
            e.acceptDrag(ddi.action);
        else 
            e.rejectDrag();
    } 
 
    public void dragOver(DropTargetDragEvent e) {
        DataFlavor[] flavors = e.getCurrentDataFlavors();
        DropTargetContext ctx = e.getDropTargetContext();
        JComponent c = (JComponent)ctx.getComponent();
        LimeTransferHandler handler = (LimeTransferHandler)c.getTransferHandler();
4
CodeRank
See Code Examples for Java 8 DropTargetContext Methods: