本文整理汇总了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();
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
示例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);
}
示例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();
}