當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。