当前位置: 首页>>代码示例>>Java>>正文


Java Dragboard.setContent方法代码示例

本文整理汇总了Java中javafx.scene.input.Dragboard.setContent方法的典型用法代码示例。如果您正苦于以下问题:Java Dragboard.setContent方法的具体用法?Java Dragboard.setContent怎么用?Java Dragboard.setContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.input.Dragboard的用法示例。


在下文中一共展示了Dragboard.setContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeSetOnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void initializeSetOnDragDetected() {
//        LoggerFacade.INSTANCE.debug(this.getClass(), "Initialize setOnDragDetected"); // NOI18N
        
        super.setOnDragDetected(event -> {
            if (super.getItem() == null) {
                return;
            }

            final Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
            final ClipboardContent content = new ClipboardContent();
            content.putString(String.valueOf(super.getItem().getProjectId()));
//            dragboard.setDragView(
//                    birdImages.get(
//                            items.indexOf(
//                                    getItem()
//                            )
//                    )
//            );
            dragboard.setContent(content);
            event.consume();
        });
    }
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:23,代码来源:ProjectItemCell.java

示例2: treeProjectFileOnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
/**
 * 트리 드래그 디텍트 이벤트 처리. <br/>
 * 트리내에 구성된 파일의 위치정보를 드래그 드롭 기능으로 <br/>
 * 전달해주는 역할을 수행한다.<br/>
 * <br/>
 * 
 * @작성자 : KYJ
 * @작성일 : 2017. 11. 21.
 * @param ev
 */
public void treeProjectFileOnDragDetected(MouseEvent ev) {
	TreeItem<JavaProjectFileWrapper> selectedItem = treeProjectFile.getSelectionModel().getSelectedItem();
	if (selectedItem == null || selectedItem.getValue() == null) {
		return;
	}

	File file = selectedItem.getValue().getFile();
	if (file == null || !file.exists())
		return;

	Dragboard board = treeProjectFile.startDragAndDrop(TransferMode.LINK);
	ClipboardContent content = new ClipboardContent();
	content.putFiles(Arrays.asList(file));
	board.setContent(content);

	ev.consume();
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:28,代码来源:SystemLayoutViewController.java

示例3: handle

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
@Override
public void handle(final MouseEvent event) {
    final Pane pane = (Pane) event.getSource();
    final ImageView view = (ImageView) pane.getChildren().get(0);
    final Dragboard db = view.startDragAndDrop(TransferMode.COPY);
    final ClipboardContent content = new ClipboardContent();
    content.putString(view.getId());
    final ComponentPane componentPane = loadComponent(pane.getChildren().get(0).getId().toLowerCase());
    workspace.getChildren().add(componentPane);
    componentPane.applyCss();
    final WritableImage w  = componentPane.snapshot(null,null);
    workspace.getChildren().remove(componentPane);
    content.putImage(w);
    db.setContent(content);
    event.consume();
}
 
开发者ID:StephaneMangin,项目名称:Synth,代码行数:17,代码来源:CoreController.java

示例4: doDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void doDragDetected(MouseEvent e) {
    ObservableList<TreeItem<File>> items = assetTree.getSelectionModel().getSelectedItems();
    if (items.isEmpty()) {
        e.consume();
        return;
    }
    List<File> files = new ArrayList<>(items.size());
    items.filtered(t -> t.getValue() != null).forEach(t -> {files.add(t.getValue());});
    if (files.size() <= 0) {
        e.consume();
        return;
    } 
    Dragboard db = assetTree.startDragAndDrop(TransferMode.COPY_OR_MOVE);
    ClipboardContent clipboardContent = new ClipboardContent();
    clipboardContent.put(DataFormat.FILES, files);
    db.setContent(clipboardContent);
    e.consume();
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:19,代码来源:AssetsForm.java

示例5: handle

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
/**
 * @see javafx.event.EventHandler#handle(javafx.event.Event)
 */
@Override
public void handle(MouseEvent event)
{
	/* drag was detected, start a drag-and-drop gesture */
	/* allow any transfer mode */
	if (node_ != null)
	{
		Dragboard db = node_.startDragAndDrop(TransferMode.COPY);

		/* Put a string on a dragboard */
		String drag = idProvider_.getConceptId();
		if (drag != null && drag.length() > 0)
		{
			ClipboardContent content = new ClipboardContent();
			content.putString(drag);
			db.setContent(content);
			AppContext.getService(DragRegistry.class).conceptDragStarted();
			event.consume();
		}
	}
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:25,代码来源:DragDetectedEventHandler.java

示例6: tokenImageView_OnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
@FXML
void tokenImageView_OnDragDetected(MouseEvent event) {
	Dragboard db = tokenImageView.startDragAndDrop(TransferMode.ANY);
	ClipboardContent content = new ClipboardContent();

	boolean saveAsToken = false;

	try {
		File tempTokenFile = fileSaveUtil.getTempFileName(saveAsToken, useFileNumberingCheckbox.isSelected(),
				fileNameTextField.getText(), fileNameSuffixTextField);

		writeTokenImage(tempTokenFile);
		content.putFiles(java.util.Collections.singletonList(tempTokenFile));
		tempTokenFile.deleteOnExit();
	} catch (Exception e) {
		log.error(e);
	} finally {
		content.putImage(tokenImageView.getImage());
		db.setContent(content);
		event.consume();
	}
}
 
开发者ID:RPTools,项目名称:tokentool,代码行数:23,代码来源:TokenTool_Controller.java

示例7: dragStart

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void dragStart (MouseEvent event) {
    Dragboard db = startDragAndDrop(TransferMode.MOVE);
    ClipboardContent cc = new ClipboardContent();
    db.setDragView(myFactory.getTransferImage(this), 0, 0);
    cc.putString(serialize(getItem(), getListView().getItems().indexOf(getItem())));
    db.setContent(cc);
    event.consume();
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:9,代码来源:WaveDragCell.java

示例8: setOnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
@Override
public void setOnDragDetected (MouseEvent e, Node source) {
    Dragboard db = source.startDragAndDrop(TransferMode.COPY);
    db.setContent(createClipboard(MOVE_STRING));
    db.setDragView(getSpriteImage(source));

    source.setVisible(false);
    levelView.getPane().setOnDragDropped(event -> setOnDragDropped(event));
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:10,代码来源:OnScreenSprite.java

示例9: setOnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
@Override
public void setOnDragDetected (MouseEvent e, Node node) {
    Dragboard db = node.startDragAndDrop(TransferMode.COPY);
    db.setContent(createClipboard(DRAG_STRING));

    db.setDragView(getSpriteImage());

    myTarget.getPane().setOnDragOver(event -> setOnDragOver(event));
    myTarget.getPane().setOnDragDropped(event -> setOnDragDropped(event));
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:11,代码来源:DraggableSpriteCell.java

示例10: dragStart

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void dragStart () {
    Dragboard db = startDragAndDrop(TransferMode.COPY);
    ClipboardContent cc = new ClipboardContent();
    cc.putString(HOLDER);
    db.setContent(cc);
    db.setDragView(getDragImage());
    myTarget.draw().setOnDragOver(event -> dragOver(event));
    myTarget.draw().setOnDragDropped(event -> drop(event));
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:10,代码来源:WaveDropCell.java

示例11: setOnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
@Override
public void setOnDragDetected (MouseEvent e, Node node) {
    createSpawner();
    Dragboard db = node.startDragAndDrop(TransferMode.COPY);
    db.setContent(createClipboard(DRAG_STRING));
    db.setDragView(getImage());
    myRenderer.getPane().setOnDragOver(event -> setOnDragOver(event));
    myRenderer.getPane().setOnDragDropped(event -> setOnDragDropped(event));
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:10,代码来源:SpawnerView.java

示例12: setOnDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
@Override
public void setOnDragDetected (MouseEvent e, Node node) {
    Dragboard db = node.startDragAndDrop(TransferMode.COPY);
    db.setContent(createClipboard(DRAG_STRING));

    db.setDragView(getSpriteImage());

    myTarget.setOnDragOver(event -> setOnDragOver(event));
    myTarget.setOnDragDropped(event -> setOnDragDropped(event));
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:11,代码来源:DraggableCell.java

示例13: dragWidget

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
/**
 * Starts the drag of the given widget tile.
 */
private void dragWidget(Tile tile, GridPoint point) {
  Dragboard dragboard = tile.startDragAndDrop(TransferMode.MOVE);
  WritableImage preview =
      new WritableImage(
          (int) tile.getBoundsInParent().getWidth(),
          (int) tile.getBoundsInParent().getHeight()
      );
  tile.snapshot(null, preview);
  dragboard.setDragView(preview);
  ClipboardContent content = new ClipboardContent();
  content.put(DataFormats.widgetTile, new DataFormats.WidgetData(tile.getId(), point));
  dragboard.setContent(content);
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:17,代码来源:WidgetPaneController.java

示例14: startDrag

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void startDrag(MouseEvent evt) {
    EventTarget target = evt.getTarget();
    if (isScrollBar(target) || !isOnEntry(target)) {
        return;
    }
    Dragboard db = startDragAndDrop(TransferMode.MOVE);
    ClipboardContent content = new ClipboardContent();

    /*
     * We have to add some content, otherwise drag over will not be called.
     */
    content.putString("dummy"); //$NON-NLS-1$
    db.setContent(content);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:AutoScrollPane.java

示例15: startDrag

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void startDrag(MouseEvent evt) {
    EventTarget target = evt.getTarget();
    if (!isOnEntry(target)) {
        return;
    }
    Dragboard db = startDragAndDrop(TransferMode.MOVE);
    ClipboardContent content = new ClipboardContent();

    /*
     * We have to add some content, otherwise drag over will not be called.
     */
    content.putString("dummy"); //$NON-NLS-1$
    db.setContent(content);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:DayViewScrollPane.java


注:本文中的javafx.scene.input.Dragboard.setContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。