/** * Constructor allowing the list model to be specified * * @param model an instance of DnDListModel * @throws IllegalArgumentException if model is null */ public DnDList(DnDListModel<T> model) { super(model); if (model == null) { throw new IllegalArgumentException("model must not be null"); } // this.setModel(model); src = new DragSource(); src.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this); tgt = new DropTarget(this, this); movingItems = false; overIndex = -1; }
public TreeDragSource(JTree tree, int actions, ProjectController eventController) { sourceTree = tree; this.eventController = eventController; source = new DragSource(); recognizer = source.createDefaultDragGestureRecognizer(sourceTree, actions, this); }
/** * Constructor. * * @param tree * The source tree * @param actions * The permitted action */ public TreeDragSource(DOMDocumentTree tree, int actions) { sourceTree = tree; source = new DragSource(); recognizer = source.createDefaultDragGestureRecognizer(sourceTree, actions, this); }
/** * Constructor. * * @param tree * The source tree * @param actions * The permitted action */ public TreeDragSource(DOMDocumentTree tree, int actions) { sourceTree = tree; source = new DragSource(); recognizer = source.createDefaultDragGestureRecognizer(sourceTree, actions, this); }
public DnDJTree() { super(new DefaultMutableTreeNode("Project")); dropTarget=new DropTarget(this,this); dragSource=new DragSource(); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE,this); }
public static void registerDragGesture(Component c, DragGesture dragGesture) { DragSource dragSource = new DragSource(); dragSource.createDefaultDragGestureRecognizer(c, DnDConstants.ACTION_MOVE, dragGesture); dragSource.addDragSourceMotionListener(dragGesture); }
/** * Constructor allowing the list model to be specified * @param model an instance of DnDListModel * @throws IllegalArgumentException if model is null */ public DnDList(DnDListModel<T> model) { super( model ); if (model == null) { throw new IllegalArgumentException("model must not be null"); } //this.setModel(model); src = new DragSource(); src.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this); tgt = new DropTarget(this, this); movingItems = false; overIndex = -1; }
final JTextField textField = new JTextField(50); DragGestureListener dragListener = new DragGestureListener() { @Override public void dragGestureRecognized(DragGestureEvent dge) { // how the drag cursor should look like Cursor cursor = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); // the component being dragged JTextField tf = (JTextField) dge.getComponent(); // Here a Transferable is created directly for a single file name dge.startDrag(cursor, new TransferableFile(tf.getText())); } }; final DragSource ds = new DragSource(); ds.createDefaultDragGestureRecognizer(textField, DnDConstants.ACTION_COPY, dragListener);
protected AbstractTreeTransferHandler(DNDTree tree, int action, boolean drawIcon) { this.tree = tree; drawImage = drawIcon; if (!GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) { dragSource = new DragSource(); dgr = dragSource.createDefaultDragGestureRecognizer(tree, action, this); dropTarget = new DropTarget(tree, action, this); } else { dragSource = null; dgr = null; dropTarget = null; } }
dragSource = new DragSource();
protected void registerDragGesture(Component c) { if (dragGesture == null) initDragGesture(); DragSource dragSource = new DragSource(); dragSource.createDefaultDragGestureRecognizer(c, DnDConstants.ACTION_MOVE, dragGesture); dragSource.addDragSourceMotionListener(dragGesture); }
/** Creates a new instance of SplashDnDSupport */ DragManager(JComponent component) { this.component = component; dSource = new DragSource(); dRecognizer = dSource.createDefaultDragGestureRecognizer(this.component,DnDConstants.ACTION_MOVE,this); dTarget = new DropTarget(this.component,DnDConstants.ACTION_MOVE,this); component.addMouseMotionListener(this); oCursor = component.getCursor(); }
private void initDragAndDrop() { dragSource = new DragSource(); dropTarget = new DropTarget(this, new DropListener()); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, listener); }
DragSource dragSource = new DragSource(); dragSource.createDefaultDragGestureRecognizer(componentTree, DnDConstants.ACTION_COPY, dragGestureListener);
this.setDropTarget(dropTarget); DragSource dragSource = new DragSource(); DragGestureRecognizer dgr = dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, new DGL());
/** * @param parent if a parent is provided, a "remove" button will be added allowing you to remove this object from the given collection */ public SmallObjectView(DisplayContext context, NamedObjectCollection namer, Object object, String title, boolean showLabel, boolean showIcon, boolean showPropButton, boolean showToString) { super(false); showIcon = false; objectValue = object; isRemoved = false; if (context == null) context = Utility.getCurrentContext(); this.context = context; this.showLabel = showLabel; this.showIcon = showIcon; this.showPropButton = showPropButton; this.showToString = showToString; this.title = title; initGUI(); this.addMouseListener(this); checkColor(); dragSource = new DragSource(); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, this); }
@Override public void registerListeners() { super.registerListeners(); // Reactivate tooltip listener ToolTipManager.sharedInstance().registerComponent(this); if (dragSource != null) { dragSource.removeDragSourceListener(this); dragSource.removeDragSourceMotionListener(this); removeFocusListener(this); } addFocusListener(this); this.setFocusable(true); this.addMouseListener(this); dragSource = new DragSource(); dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, this); dragSource.addDragSourceMotionListener(this); }
public DnDTabbedPane(OutwardDndTabbedPaneChanel outwardDndTabbedPaneChanel) { _dnDTabbedPaneData = new DnDTabbedPaneData(this); _glassPane = new GhostGlassPane(_dnDTabbedPaneData); DragSourceListener dsl = new DndTabbedPaneDragSourceListener(_glassPane, _dnDTabbedPaneData, outwardDndTabbedPaneChanel); Transferable t = new DndTabbedPaneTransferable(_dnDTabbedPaneData); DragGestureListener dgl = new DndTabbedPaneDragGestureListener(t, dsl, _dnDTabbedPaneData, _glassPane); new DropTarget(_glassPane, DnDConstants.ACTION_COPY_OR_MOVE, new DndTabbedPaneDropTargetListener(_dnDTabbedPaneData, _glassPane, outwardDndTabbedPaneChanel), true); if (null != outwardDndTabbedPaneChanel) { new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, new OutwardDndTabbedPaneDropTargetListener(_dnDTabbedPaneData, _glassPane, outwardDndTabbedPaneChanel), true); } new DragSource().createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dgl); }
public DnDTabbedPane(OutwardDndTabbedPaneChanel outwardDndTabbedPaneChanel) { _dnDTabbedPaneData = new DnDTabbedPaneData(this); _glassPane = new GhostGlassPane(_dnDTabbedPaneData); DragSourceListener dsl = new DndTabbedPaneDragSourceListener(_glassPane, _dnDTabbedPaneData, outwardDndTabbedPaneChanel); Transferable t = new DndTabbedPaneTransferable(_dnDTabbedPaneData); DragGestureListener dgl = new DndTabbedPaneDragGestureListener(t, dsl, _dnDTabbedPaneData, _glassPane); new DropTarget(_glassPane, DnDConstants.ACTION_COPY_OR_MOVE, new DndTabbedPaneDropTargetListener(_dnDTabbedPaneData, _glassPane, outwardDndTabbedPaneChanel), true); if (null != outwardDndTabbedPaneChanel) { new DropTarget(this, DnDConstants.ACTION_COPY_OR_MOVE, new OutwardDndTabbedPaneDropTargetListener(_dnDTabbedPaneData, _glassPane, outwardDndTabbedPaneChanel), true); } new DragSource().createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY_OR_MOVE, dgl); }
/** Creates a new instance of ResourceImageList */ public ResourceImageList() { this.setModel(new ResourceImageListModel()); this.setCellRenderer(new TileCellRenderer(padX, padY)); this.setLayoutOrientation(JList.HORIZONTAL_WRAP); this.setVisibleRowCount(-1); this.addListSelectionListener(new ResourceImageListSelectionListener()); this.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { int index = ResourceImageList.this.getSelectedIndex(); if (index != -1) { StaticTile tile = (StaticTile) ResourceImageList.this.getModel().getElementAt(index); tile.getImageResource().getGameDesign().getMainView().requestPreview(tile); tile.getImageResource().getGameDesign().getMainView().paintTileChanged(tile); } } }); DragSource dragSource = new DragSource(); DragGestureRecognizer dgr = dragSource.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, new DGL()); }