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


Java Dragboard.setDragView方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: onDrag

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void onDrag (MouseEvent event) {
    ElementSelectionModel.getInstance().setSelected(this);
    Dragboard db = this.startDragAndDrop(TransferMode.ANY);
    ClipboardContent content = new ClipboardContent();
    content.putString(getId());
    db.setContent(content);
    if (!this.imagePath.get().contains(".gif")) {
        db.setDragView(this.getImage());
    }
    event.consume();
}
 
开发者ID:sjain28,项目名称:Game-Engine-Vooga,代码行数:12,代码来源:GameObject.java

示例9: startDragFile

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void startDragFile(MouseEvent me) {
   Dragboard db = startDragAndDrop(TransferMode.ANY);
   db.setDragView(snapshot(new SnapshotParameters(), null));

   ClipboardContent filesToCopyClipboard = new ClipboardContent();
   filesToCopyClipboard.putFiles(Collections.singletonList(getFile()));
   db.setContent(filesToCopyClipboard);
   me.consume();		
}
 
开发者ID:salimvanak,项目名称:myWMS,代码行数:10,代码来源:FileOutputPane.java

示例10: handleRowDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
protected void handleRowDragDetected(TreeTableRow<T> r, MouseEvent ev)
{
	if(!r.isEmpty())
	{
		// TODO support multiple selection
		Dragboard db = r.startDragAndDrop(TransferMode.MOVE);
		db.setDragView(r.snapshot(null, null));
		ClipboardContent cc = new ClipboardContent();
		cc.put(JAVA_DATA_FORMAT, r.getIndex());
		db.setContent(cc);
		ev.consume();
	}
}
 
开发者ID:andy-goryachev,项目名称:ReqTraq,代码行数:14,代码来源:TreeTableHandler.java

示例11: handleDragOnBlockDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void handleDragOnBlockDetected(MouseEvent event) {
	ImageView imageView = (ImageView) event.getSource();
	Dragboard db = imageView.startDragAndDrop(TransferMode.ANY);
	ClipboardContent content = new ClipboardContent();
	content.putString("addrobot");
	db.setContent(content);
	db.setDragView(imageView.getImage());
	event.consume();
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:10,代码来源:TrackManagerController.java

示例12: beginDrag

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
/**
 * Begins the drag action. Creates the dragboard on the root node and adds a snapshot of the root
 * node as the view.
 *
 * @param value The value to be transferred during the drag.
 * @param root  The root node to drag
 * @param name  The name to set as the content of the dragboard
 */
public void beginDrag(T value, Node root, String name) {
  // Create a snapshot to use as the cursor
  final ImageView preview = new ImageView(root.snapshot(null, null));

  final Dragboard db = root.startDragAndDrop(TransferMode.ANY);
  db.setContent(Collections.singletonMap(DataFormat.PLAIN_TEXT, name));
  db.setDragView(preview.getImage());

  this.dragProperty.set(value);
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:19,代码来源:DragService.java

示例13: onDragDetected

import javafx.scene.input.Dragboard; //导入方法依赖的package包/类
private void onDragDetected(MouseEvent event) {

		Factory<Effect> factory = getItem();

		if (factory != null) {

			Effect effect = factory.create();
			EffectLayer effectLayer = new EffectLayer(effect);
			LayerBaseContainer<? extends LayerBase> layerBaseContainer = new EffectLayerContainer(effectLayer);

			if (layerBaseContainer != null) {
				Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
				dragboard.setDragView(snapshot(null, null), 10, 10);

				Map<DataFormat, Object> data = new HashMap<>();

				String name = factory.getName();
				data.put(LayerBaseTreeCell.LAYER_DATA_FORMAT, name);
				data.put(DataFormat.PLAIN_TEXT, name);

				TreeItem<LayerBaseContainer<? extends LayerBase>> treeItem = new TreeItem<>(layerBaseContainer);
				LayerTreeItemListenerUtil.addListenersToTreeItem(treeItem);
				LayerTreeCellDragboard.setCurrentlyDraggedLayerTreeItem(treeItem);

				dragboard.setContent(data);
			}

		}

		event.consume();

	}
 
开发者ID:enoy19,项目名称:keyboard-light-composer,代码行数:33,代码来源:EffectFactoryListCell.java


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