javafx.scene.input.TransferMode Java Examples

The following examples show how to use javafx.scene.input.TransferMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArtistsMainController.java    From MusicPlayer with MIT License 6 votes vote down vote up
AlbumCell() {
    super();
    setAlignment(Pos.CENTER);
    setPrefHeight(140);
    setPrefWidth(140);
    albumArtwork.setFitWidth(130);
    albumArtwork.setFitHeight(130);
    albumArtwork.setPreserveRatio(true);
    albumArtwork.setSmooth(true);
    albumArtwork.setCache(true);
    
    this.setOnMouseClicked(event -> albumList.getSelectionModel().select(album));
    
    this.setOnDragDetected(event -> {
    	Dragboard db = this.startDragAndDrop(TransferMode.ANY);
    	ClipboardContent content = new ClipboardContent();
        content.putString("Album");
        db.setContent(content);
    	MusicPlayer.setDraggedItem(album);
    	db.setDragView(this.snapshot(null, null), 75, 75);
        event.consume();
    });
}
 
Example #2
Source File: DragAndDropUtil.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Registers the given [source] javafx Node as a source for a drag
 * and drop even with {@link #NODE_RANGE_DATA_FORMAT} content.
 */
public static Subscription registerAsNodeDragSource(javafx.scene.Node source, Node data, DesignerRoot root) {
    source.setOnDragDetected(evt -> {
        // drag and drop
        Dragboard db = source.startDragAndDrop(TransferMode.LINK);
        ClipboardContent content = new ClipboardContent();
        content.put(NODE_RANGE_DATA_FORMAT, TextRange.fullLine(data.getBeginLine(), 10000));
        db.setContent(content);
        root.getService(DesignerRoot.IS_NODE_BEING_DRAGGED).setValue(true);
        evt.consume();
    });

    source.setOnDragDone(evt -> {
        if (evt.getDragboard().hasContent(NODE_RANGE_DATA_FORMAT)) {
            root.getService(DesignerRoot.IS_NODE_BEING_DRAGGED).setValue(false);
        }
    });

    return () -> source.setOnDragDetected(null);
}
 
Example #3
Source File: NBTTreeView.java    From mcaselector with MIT License 6 votes vote down vote up
private void onDragDetected(MouseEvent e) {
	if (getTreeItem() == getTreeView().getRoot()) {
		return;
	}
	Dragboard db = startDragAndDrop(TransferMode.MOVE);
	WritableImage wi = new WritableImage((int) getWidth(), (int) getHeight());
	Image dbImg = snapshot(null, wi);
	db.setDragView(dbImg);
	if (USE_DRAGVIEW_OFFSET) {
		db.setDragViewOffsetX(getWidth() / 2);
		db.setDragViewOffsetY(getHeight() / 2);
	}
	ClipboardContent cbc = new ClipboardContent();
	cbc.put(CLIPBOARD_DATAFORMAT, true);
	db.setContent(cbc);
	dragboardContent = getTreeItem();
	e.consume();
}
 
Example #4
Source File: JaceUIController.java    From jace with GNU General Public License v2.0 6 votes vote down vote up
private void processDragEnteredEvent(DragEvent evt) {
    MediaEntry media = null;
    if (evt.getDragboard().hasFiles()) {
        media = MediaCache.getMediaFromFile(getDraggedFile(evt.getDragboard().getFiles()));
    } else if (evt.getDragboard().hasUrl()) {
        media = MediaCache.getMediaFromUrl(evt.getDragboard().getUrl());
    } else if (evt.getDragboard().hasString()) {
        String path = evt.getDragboard().getString();
        try {
            URI.create(path);
            media = MediaCache.getMediaFromUrl(path);
        } catch (IllegalArgumentException ex) {
            File f = new File(path);
            if (f.exists()) {
                media = MediaCache.getMediaFromFile(f);
            }
        }
    }
    if (media != null) {
        evt.acceptTransferModes(TransferMode.LINK, TransferMode.COPY);
        startDragEvent(media);
    }
}
 
Example #5
Source File: AlarmTreeView.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** For leaf nodes, drag PV name */
private void addDragSupport()
{
    tree_view.setOnDragDetected(event ->
    {
        final ObservableList<TreeItem<AlarmTreeItem<?>>> items = tree_view.getSelectionModel().getSelectedItems();
        if (items.size() != 1)
            return;
        final AlarmTreeItem<?> item = items.get(0).getValue();
        if (! (item instanceof AlarmClientLeaf))
            return;
        final Dragboard db = tree_view.startDragAndDrop(TransferMode.COPY);
        final ClipboardContent content = new ClipboardContent();
        content.putString(item.getName());
        db.setContent(content);
        event.consume();
    });
}
 
Example #6
Source File: AlarmTableUI.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Enable dragging the PV name from a table cell.
 *  @param cell Table cell
 */
static void enablePVDrag(TableCell<AlarmInfoRow, ?> cell)
{
    // Tried to use table.setOnDragDetected() to drag PV names
    // from all selected cells, but with drag enabled on the table
    // it is no longer possible to resize columns:
    // Moving a column divider starts a drag.
    // So now hooking drag to table cell.
    cell.setOnDragDetected(event ->
    {
        // Anything to drag?
        if (cell.getTableRow() == null  ||  cell.getTableRow().getItem() == null)
            return;

        final Dragboard db = cell.startDragAndDrop(TransferMode.COPY);
        final ClipboardContent content = new ClipboardContent();
        content.putString(cell.getTableRow().getItem().pv.get());
        db.setContent(content);
        event.consume();
    });
}
 
Example #7
Source File: SearchView.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Allow dragging {@link ChannelInfo} from search view (into plot) */
private void setupDrag()
{
    channel_table.setOnDragDetected(event ->
    {
        final List<ChannelInfo> selection = channel_table.getSelectionModel().getSelectedItems();
        if (selection.size() > 0)
        {
            final Dragboard db = channel_table.startDragAndDrop(TransferMode.COPY);
            final ClipboardContent content = new ClipboardContent();
            // Publish PV names as "PV1, PV2, ..."
            content.putString(selection.stream().map(ChannelInfo::getName).collect(Collectors.joining(", ")));
            // Copy into ArrayList which is for sure Serializable
            content.put(CHANNEL_INFOS, new ArrayList<>(selection));
            db.setContent(content);
        }
        event.consume();
    });
}
 
Example #8
Source File: DockItem.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
/** Allow dragging this item */
private void handleDragDetected(final MouseEvent event)
{
    // Disable dragging from a 'fixed' pane
    if (getDockPane().isFixed())
        return;

    final Dragboard db = name_tab.startDragAndDrop(TransferMode.MOVE);

    final ClipboardContent content = new ClipboardContent();
    content.put(DOCK_ITEM, getLabel());
    db.setContent(content);

    final DockItem previous = dragged_item.getAndSet(this);
    if (previous != null)
        logger.log(Level.WARNING, "Already dragging " + previous);

    event.consume();
}
 
Example #9
Source File: FilesController.java    From AudioBookConverter with GNU General Public License v2.0 6 votes vote down vote up
private void addDragEvenHandlers(Control control) {
    control.setOnDragOver(event -> {
        if (event.getGestureSource() != control && event.getDragboard().hasFiles()) {
            event.acceptTransferModes(TransferMode.ANY);
        }

        event.consume();
    });

    control.setOnDragDropped(event -> {
        processFiles(event.getDragboard().getFiles());
        event.setDropCompleted(true);
        event.consume();
        if (!chaptersMode.get()) {
            if (!filesChapters.getTabs().contains(filesTab)) {
                filesChapters.getTabs().add(filesTab);
                filesChapters.getSelectionModel().select(filesTab);
            }
        }
    });
}
 
Example #10
Source File: ResourcePropertyEditorControl.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Handle drag over.
 */
@FxThread
private void dragOver(@NotNull DragEvent dragEvent) {

    var dragboard = dragEvent.getDragboard();
    var files = ClassUtils.<List<File>>unsafeCast(dragboard.getContent(DataFormat.FILES));

    if (files == null || files.size() != 1) {
        return;
    }

    var file = files.get(0);
    if (!canAccept(file)) {
        return;
    }

    var transferModes = dragboard.getTransferModes();
    var isCopy = transferModes.contains(TransferMode.COPY);

    dragEvent.acceptTransferModes(isCopy ? TransferMode.COPY : TransferMode.MOVE);
    dragEvent.consume();
}
 
Example #11
Source File: MaterialPropertyControl.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
/**
 * Handle drag over events.
 *
 * @param dragEvent the drag over event.
 */
@FxThread
private void handleDragOverEvent(@NotNull DragEvent dragEvent) {

    var dragboard = dragEvent.getDragboard();
    var files = EditorUtil.getFiles(dragboard);
    if (files.size() != 1) {
        return;
    }

    var file = files.get(0);

    if (!file.getName().endsWith(FileExtensions.JME_MATERIAL)) {
        return;
    }

    var transferModes = dragboard.getTransferModes();
    var isCopy = transferModes.contains(TransferMode.COPY);

    dragEvent.acceptTransferModes(isCopy ? TransferMode.COPY : TransferMode.MOVE);
    dragEvent.consume();
}
 
Example #12
Source File: SuitStack.java    From Solitaire with GNU General Public License v2.0 6 votes vote down vote up
private EventHandler<DragEvent> createOnDragOverHandler(final ImageView pView)
{
	return new EventHandler<DragEvent>()
   	{
   	    public void handle(DragEvent pEvent) 
   	    {
   	    	if(pEvent.getGestureSource() != pView && pEvent.getDragboard().hasString())
   	    	{
   	    		CardTransfer transfer = new CardTransfer(pEvent.getDragboard().getString());
   	    		if( transfer.size() == 1 && GameModel.instance().isLegalMove(transfer.getTop(), aIndex) )
   	    		{
   	    			pEvent.acceptTransferModes(TransferMode.MOVE);
   	    		}
   	    	}

   	    	pEvent.consume();
   	    }
   	};
}
 
Example #13
Source File: CardPileView.java    From Solitaire with GNU General Public License v2.0 6 votes vote down vote up
private EventHandler<DragEvent> createDragOverHandler(final ImageView pImageView, final Card pCard)
{
	return new EventHandler<DragEvent>()
	{
		@Override
		public void handle(DragEvent pEvent) 
		{
			if(pEvent.getGestureSource() != pImageView && pEvent.getDragboard().hasString())
			{
				CardTransfer transfer = new CardTransfer(pEvent.getDragboard().getString());
				if( GameModel.instance().isLegalMove(transfer.getTop(), aIndex) )
				{
					pEvent.acceptTransferModes(TransferMode.MOVE);
				}
			}
			pEvent.consume();
		}
	};
}
 
Example #14
Source File: ArtistsMainController.java    From MusicPlayer with MIT License 6 votes vote down vote up
ArtistCell() {
    super();
    artistImage.setFitWidth(40);
    artistImage.setFitHeight(40);
    artistImage.setPreserveRatio(true);
    artistImage.setSmooth(true);
    artistImage.setCache(true);
    title.setTextOverrun(OverrunStyle.CLIP);
    cell.getChildren().addAll(artistImage, title);
    cell.setAlignment(Pos.CENTER_LEFT);
    HBox.setMargin(artistImage, new Insets(0, 10, 0, 0));
    this.setPrefWidth(248);
    
    this.setOnMouseClicked(event -> artistList.getSelectionModel().select(artist));
    
    this.setOnDragDetected(event -> {
    	Dragboard db = this.startDragAndDrop(TransferMode.ANY);
    	ClipboardContent content = new ClipboardContent();
        content.putString("Artist");
        db.setContent(content);
    	MusicPlayer.setDraggedItem(artist);
    	db.setDragView(this.snapshot(null, null), 125, 25);
    	event.consume();
    });
}
 
Example #15
Source File: FileTreeCell.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Determines the {@link TransferMode} based on the state of the modifier key.
 * This method must consider the
 * operating system as the identity of the modifier key varies (alt/option on Mac OS, ctrl on the rest).
 * @param event The mouse event containing information on key press.
 * @return {@link TransferMode#COPY} if modifier key is pressed, otherwise {@link TransferMode#MOVE}.
 */
private TransferMode getTransferMode(MouseEvent event){
    if(event.isControlDown() && (PlatformInfo.is_linux || PlatformInfo.isWindows || PlatformInfo.isUnix)){
        return TransferMode.COPY;
    }
    else if(event.isAltDown() && PlatformInfo.is_mac_os_x){
        return TransferMode.COPY;
    }
    return TransferMode.MOVE;
}
 
Example #16
Source File: FileDragAndDrop.java    From LogFX with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Install file drag-and-drop functionality onto the given Node.
 *
 * @param node   node to accept file drop
 * @param onDrop action on drop
 */
public static void install( Node node,
                            Consumer<File> onDrop ) {
    node.setOnDragEntered( event -> {
        FxUtils.addIfNotPresent( node.getStyleClass(), "dropping-files" );
    } );

    node.setOnDragExited( event -> {
        node.getStyleClass().remove( "dropping-files" );
    } );

    node.setOnDragOver( event -> {
        if ( event.getDragboard().hasFiles() ) {
            event.acceptTransferModes( TransferMode.ANY );
        }
        event.consume();
    } );

    node.setOnDragDropped( event -> {
        Dragboard db = event.getDragboard();
        boolean success = false;

        if ( db.hasFiles() ) {
            log.debug( "Dropping files: {}", db.getFiles() );
            for ( File draggedFile : db.getFiles() ) {
                if ( draggedFile.isFile() ) {
                    onDrop.accept( draggedFile );
                    success = true;
                }
            }
        }

        event.setDropCompleted( success );
        event.consume();
    } );
}
 
Example #17
Source File: JobController.java    From Schillsaver with MIT License 5 votes vote down vote up
/** Sets all of the view's controls to use this class as their event handler. */
private void addEventHandlers() {
    final JobModel model = (JobModel) super.getModel();
    final JobView view = (JobView) super.getView();

    view.getButton_addFiles().setOnAction(this);
    view.getButton_removeSelectedFiles().setOnAction(this);
    view.getButton_selectOutputFolder().setOnAction(this);
    view.getButton_accept().setOnAction(this);
    view.getButton_cancel().setOnAction(this);

    // Allow the user to drag and drop files onto the view in order to
    // add those files to the Job's file list.
    view.getPane().setOnDragOver(event -> {
        if (event.getDragboard().hasFiles()) {
            event.acceptTransferModes(TransferMode.COPY);
        } else {
            event.consume();
        }
    });

    view.getPane().setOnDragDropped(event -> {
        final Dragboard db = event.getDragboard();

        if (db.hasFiles()) {
            for (final File file : db.getFiles()) {
                view.getFileList().getItems().add(file.getName());
                model.addFile(file);
            }

            event.setDropCompleted(true);
        } else {
            event.setDropCompleted(false);
        }

        event.consume();
    });
}
 
Example #18
Source File: SplitMergeController.java    From ns-usbloader with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Drag-n-drop support (dragOver consumer)
 * */
@FXML
private void handleDragOver(DragEvent event){
    if (event.getDragboard().hasFiles() && ! MediatorControl.getInstance().getTransferActive())
        event.acceptTransferModes(TransferMode.ANY);
    event.consume();
}
 
Example #19
Source File: ApkInfoPrinterActivity.java    From ApkToolPlus with Apache License 2.0 5 votes vote down vote up
public void onDragOverLinkFile(DragEvent event){
    Dragboard db = event.getDragboard();
    if (db.hasFiles()) {
        event.acceptTransferModes(TransferMode.LINK);
    } else {
        event.consume();
    }
}
 
Example #20
Source File: ResourceConfigurationView.java    From beatoraja with GNU General Public License v3.0 5 votes vote down vote up
@FXML
public void onSongPathDragOver(DragEvent ev) {
	Dragboard db = ev.getDragboard();
	if (db.hasFiles()) {
		ev.acceptTransferModes(TransferMode.COPY_OR_MOVE);
	}
	ev.consume();
}
 
Example #21
Source File: RootLayout.java    From java_fx_node_link_demo with The Unlicense 5 votes vote down vote up
private void addDragDetection(DragIcon dragIcon) {
	
	dragIcon.setOnDragDetected (new EventHandler <MouseEvent> () {

		@Override
		public void handle(MouseEvent event) {

			// set drag event handlers on their respective objects
			base_pane.setOnDragOver(mIconDragOverRoot);
			right_pane.setOnDragOver(mIconDragOverRightPane);
			right_pane.setOnDragDropped(mIconDragDropped);
			
			// get a reference to the clicked DragIcon object
			DragIcon icn = (DragIcon) event.getSource();
			
			//begin drag ops
			mDragOverIcon.setType(icn.getType());
			mDragOverIcon.relocateToPoint(new Point2D (event.getSceneX(), event.getSceneY()));
           
			ClipboardContent content = new ClipboardContent();
			DragContainer container = new DragContainer();
			
			container.addData ("type", mDragOverIcon.getType().toString());
			content.put(DragContainer.AddNode, container);

			mDragOverIcon.startDragAndDrop (TransferMode.ANY).setContent(content);
			mDragOverIcon.setVisible(true);
			mDragOverIcon.setMouseTransparent(true);
			event.consume();					
		}
	});
}
 
Example #22
Source File: RootLayout.java    From java_fx_node_link_demo with The Unlicense 5 votes vote down vote up
private void addDragDetection(DragIcon dragIcon) {
	
	dragIcon.setOnDragDetected (new EventHandler <MouseEvent> () {

		@Override
		public void handle(MouseEvent event) {

			// set drag event handlers on their respective objects
			base_pane.setOnDragOver(mIconDragOverRoot);
			right_pane.setOnDragOver(mIconDragOverRightPane);
			right_pane.setOnDragDropped(mIconDragDropped);
			
			// get a reference to the clicked DragIcon object
			DragIcon icn = (DragIcon) event.getSource();
			
			//begin drag ops
			mDragOverIcon.setType(icn.getType());
			mDragOverIcon.relocateToPoint(new Point2D (event.getSceneX(), event.getSceneY()));
           
			ClipboardContent content = new ClipboardContent();
			DragContainer container = new DragContainer();
			
			container.addData ("type", mDragOverIcon.getType().toString());
			content.put(DragContainer.AddNode, container);

			mDragOverIcon.startDragAndDrop (TransferMode.ANY).setContent(content);
			mDragOverIcon.setVisible(true);
			mDragOverIcon.setMouseTransparent(true);
			event.consume();					
		}
	});
}
 
Example #23
Source File: RootLayout.java    From java_fx_node_link_demo with The Unlicense 5 votes vote down vote up
private void addDragDetection(DragIcon dragIcon) {
	
	dragIcon.setOnDragDetected (new EventHandler <MouseEvent> () {

		@Override
		public void handle(MouseEvent event) {

			// set drag event handlers on their respective objects
			base_pane.setOnDragOver(mIconDragOverRoot);
			right_pane.setOnDragOver(mIconDragOverRightPane);
			right_pane.setOnDragDropped(mIconDragDropped);
			
			// get a reference to the clicked DragIcon object
			DragIcon icn = (DragIcon) event.getSource();
			
			//begin drag ops
			mDragOverIcon.setType(icn.getType());
			mDragOverIcon.relocateToPoint(new Point2D (event.getSceneX(), event.getSceneY()));
           
			ClipboardContent content = new ClipboardContent();
			DragContainer container = new DragContainer();
			
			container.addData ("type", mDragOverIcon.getType().toString());
			content.put(DragContainer.AddNode, container);

			mDragOverIcon.startDragAndDrop (TransferMode.ANY).setContent(content);
			mDragOverIcon.setVisible(true);
			mDragOverIcon.setMouseTransparent(true);
			event.consume();					
		}
	});
}
 
Example #24
Source File: CardDragHandler.java    From Solitaire with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void handle(MouseEvent pMouseEvent)
{
	Dragboard db = aImageView.startDragAndDrop(TransferMode.ANY);
       CLIPBOARD_CONTENT.putString(aCard.getIDString());
       db.setContent(CLIPBOARD_CONTENT);
       pMouseEvent.consume();
}
 
Example #25
Source File: FrontController.java    From ns-usbloader with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Drag-n-drop support (dragOver consumer)
 * */
@FXML
private void handleDragOver(DragEvent event){
    if (event.getDragboard().hasFiles() && ! MediatorControl.getInstance().getTransferActive())
        event.acceptTransferModes(TransferMode.ANY);
    event.consume();
}
 
Example #26
Source File: CardPileView.java    From Solitaire with GNU General Public License v2.0 5 votes vote down vote up
private EventHandler<MouseEvent> createDragDetectedHandler(final ImageView pImageView, final Card pCard)
{
	return new EventHandler<MouseEvent>() 
	{
		@Override
		public void handle(MouseEvent pMouseEvent) 
		{
			Dragboard db = pImageView.startDragAndDrop(TransferMode.ANY);
			CLIPBOARD_CONTENT.putString(CardTransfer.serialize(GameModel.instance().getSubStack(pCard, aIndex)));
			db.setContent(CLIPBOARD_CONTENT);
			pMouseEvent.consume();
		}
	};
}
 
Example #27
Source File: RcmController.java    From ns-usbloader with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Drag-n-drop support (dragOver consumer)
 * */
@FXML
private void handleDragOver(DragEvent event){
    if (event.getDragboard().hasFiles())
        event.acceptTransferModes(TransferMode.ANY);
    event.consume();
}
 
Example #28
Source File: MarkdownEditorPane.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void onDragOver(DragEvent event) {
	// check whether we can accept a drop
	Dragboard db = event.getDragboard();
	if (db.hasString() || db.hasFiles())
		event.acceptTransferModes(TransferMode.COPY);

	// move drag caret to mouse location
	if (event.isAccepted()) {
		CharacterHit hit = textArea.hit(event.getX(), event.getY());
		dragCaret.moveTo(hit.getInsertionIndex());
	}

	event.consume();
}
 
Example #29
Source File: ProjectFileTreeView.java    From markdown-writer-fx with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private TreeCell<File> createCell(TreeView<File> treeView) {
	FileTreeCell treeCell = new FileTreeCell();
	treeCell.setOnDragDetected(event -> {
		TreeItem<File> draggedItem = treeCell.getTreeItem();
		Dragboard db = treeCell.startDragAndDrop(TransferMode.COPY);

		ClipboardContent content = new ClipboardContent();
		content.putString(draggedItem.getValue().getAbsolutePath());
		content.put(DataFormat.FILES, Collections.singletonList(draggedItem.getValue()));
		db.setContent(content);

		event.consume();
	});
	return treeCell;
}
 
Example #30
Source File: JFXBaseRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
/** By default, allow dragging a "pv_name" from the widget in runtime mode
 *
 *  <p>Derived classes can override, for example to disable
 *  in case the representation already handles dragging moves
 *  to for example operate a slider or pan something.
 */
// Note: In RCP version, the D&D had to be handled in SWT,
// and was implemented in the org.csstudio.display.builder.rcp.RuntimeViewPart.
// Widget.isDragEnabled() was used to enable/disable.
// Now the enablement is left to the representation,
// and since only Ctrl-drag is supported,
// only very few widget representations need to disable it.
protected void configurePVNameDrag()
{
    // If there is a "pv_name", allow dragging it out
    final Optional<WidgetProperty<String>> pv_name = model_widget.checkProperty(CommonWidgetProperties.propPVName);
    if (! pv_name.isPresent())
        return;

    jfx_node.addEventFilter(MouseEvent.DRAG_DETECTED, event ->
    {
        // Ignore drag unless Ctrl is held.
        // When plain drag starts a PV name move,
        // this prevents selecting content within a text field
        // via a mouse drag.
        // Ctrl-drag is thus required to start dragging a PV name.
        if (! event.isControlDown())
            return;

        final String pv = pv_name.get().getValue();
        if (! pv.isEmpty())
        {
            final Dragboard db = jfx_node.startDragAndDrop(TransferMode.COPY);
            final ClipboardContent content = new ClipboardContent();
            content.putString(pv);
            db.setContent(content);
        }
    });
}