當前位置: 首頁>>代碼示例>>Java>>正文


Java Dragboard.hasString方法代碼示例

本文整理匯總了Java中javafx.scene.input.Dragboard.hasString方法的典型用法代碼示例。如果您正苦於以下問題:Java Dragboard.hasString方法的具體用法?Java Dragboard.hasString怎麽用?Java Dragboard.hasString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.input.Dragboard的用法示例。


在下文中一共展示了Dragboard.hasString方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeSetOnDragDropped

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
private void initializeSetOnDragDropped() {
//        LoggerFacade.INSTANCE.debug(this.getClass(), "Initialize setOnDragDropped"); // NOI18N

        super.setOnDragDropped(event -> {
            if (super.getItem() == null) {
                return;
            }

            final Dragboard dragboard = event.getDragboard();
            boolean success = false;
            if (dragboard.hasString()) {
                final List<ProjectItemPresenter> items = this.updateOverview(dragboard);
                this.updateDatabase(items);

                success = true;
            }

            event.setDropCompleted(success);
            event.consume();
        });
    }
 
開發者ID:Naoghuman,項目名稱:Incubator,代碼行數:22,代碼來源:ProjectItemCell.java

示例2: handleDragDropped

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
private void handleDragDropped(DragEvent event) {
    LOGGER.debug("drag dropped");

    Dragboard dragboard = event.getDragboard();
    boolean success = dragboard.hasString();
    if (success) {
        try {
            int slideId = Integer.parseInt(dragboard.getString());
            LOGGER.debug("dropped slide with id {} on divider", slideId);

            if (slideDroppedCallback != null) {
                slideDroppedCallback.accept(slideId);
            }
        } catch (NumberFormatException ex) {
            success = false;
        }

    }
    event.setDropCompleted(success);
    event.consume();
}
 
開發者ID:travelimg,項目名稱:travelimg,代碼行數:22,代碼來源:SlideDivider.java

示例3: createOnDragDroppedHandler

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
private EventHandler<DragEvent> createOnDragDroppedHandler()
{
	return new EventHandler<DragEvent>() 
   	{
   		public void handle(DragEvent pEvent)
   		{
   			Dragboard db = pEvent.getDragboard();
   			boolean success = false;
   			if(db.hasString()) 
   			{
   				CardTransfer transfer = new CardTransfer(pEvent.getDragboard().getString());
   				GameModel.instance().getCardMove(transfer.getTop(), aIndex).perform();
   				success = true;
   			}
   			pEvent.setDropCompleted(success);
   			pEvent.consume();
   		}
   	};
}
 
開發者ID:prmr,項目名稱:Solitaire,代碼行數:20,代碼來源:SuitStack.java

示例4: createDragDroppedHandler

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
private EventHandler<DragEvent> createDragDroppedHandler(final ImageView pImageView, final Card pCard)
{
	return new EventHandler<DragEvent>() 
	{
		public void handle(DragEvent pEvent)
		{
			Dragboard db = pEvent.getDragboard();
			boolean success = false;
			if(db.hasString()) 
			{
				GameModel.instance().getCardMove(new CardTransfer(db.getString()).getTop(), aIndex).perform(); 
				success = true;
			}

			pEvent.setDropCompleted(success);

			pEvent.consume();
		}
	};
}
 
開發者ID:prmr,項目名稱:Solitaire,代碼行數:21,代碼來源:CardStack.java

示例5: handleDragDroppedAction

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
/**
 * handleDragDroppedAction() method.
 *
 * @param argEvent the event handled
 */
@FXML
protected final void handleDragDroppedAction(final DragEvent argEvent) {
    final Dragboard board = argEvent.getDragboard();
    boolean success = false;
    if (board.hasString()) {
        final TreeView target = (TreeView) argEvent.getSource();
        @SuppressWarnings("unchecked") final TreeItem<String> tmp = new TreeItem(board.getString());
        //noinspection unchecked
        target.getRoot().getChildren().add(tmp);
        success = true;
    }
    argEvent.setDropCompleted(success);
    argEvent.consume();
    LOG.info("Drag dropped");
}
 
開發者ID:yeamanan,項目名稱:ProjectTwo,代碼行數:21,代碼來源:SurvivorEditorController.java

示例6: setOnDragDropped

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
@Override
public void setOnDragDropped (DragEvent e) {
    if (checkPlaceableTile(e)) {
        Dragboard db = e.getDragboard();
        if (db.hasString()) {
            addSprite(e.getX(), e.getY());
        }
    }
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:10,代碼來源:DraggableSpriteCell.java

示例7: setOnDragDropped

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
@Override
public void setOnDragDropped (DragEvent e) {
    Dragboard db = e.getDragboard();
    if (db.hasString()) {
        if (!myTarget.getItems().contains(getProfilable())) {
            myTarget.getItems().add(getProfilable());
        }
    }
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:10,代碼來源:DraggableAddCell.java

示例8: mouseDragDropped

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
private void mouseDragDropped (final DragEvent event) {
    Dragboard db = event.getDragboard();
    boolean success = false;
    if (db.hasContent(VoogaFileFormat.getInstance())) {
        VoogaFile node = (VoogaFile) db.getContent(VoogaFileFormat.getInstance());
        if (node.getType() != VoogaFileType.FOLDER) {
            if (node.getType() != VoogaFileType.ARCHETYPE &&
                node.getType() != VoogaFileType.GAME_OBJECT) {
                if (elementManager.hasElement(node.getPath())) {
                    moveElement(node.getPath(), event);
                }
                else {
                    addElement(node, event, "");
                }
            }
            else {
                if (node.getType() == VoogaFileType.ARCHETYPE) {
                    addElement(node, event, node.toString());
                }
            }
        }
        success = true;
    }

    if (db.hasString()) {
        Node object = (Node) elementManager.getElement(db.getString());
        object.setTranslateX(event.getX() - x_offset);
        object.setTranslateY(event.getY() - y_offset);
    }

    event.setDropCompleted(success);
}
 
開發者ID:sjain28,項目名稱:Game-Engine-Vooga,代碼行數:33,代碼來源:DesignBoard.java

示例9: destinationFieldOnDragOver

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
public void destinationFieldOnDragOver(DragEvent event) {
    Dragboard db = event.getDragboard();
    if (event.getGestureSource() != destnationField) {
        if (db.hasString() && Files.isDirectory(new File(db.getString()).toPath())) {
            destnationField.requestFocus();
            event.acceptTransferModes(TransferMode.COPY);
        } else if (db.hasFiles() && Files.isDirectory(db.getFiles().get(0).toPath())) {
            destnationField.requestFocus();
            event.acceptTransferModes(TransferMode.LINK);
        }
    }
    event.consume();
}
 
開發者ID:abhishekmunie,項目名稱:Magic-Copier,代碼行數:14,代碼來源:MagicCopierPreferencesController.java

示例10: destinationFieldOnDragDropped

import javafx.scene.input.Dragboard; //導入方法依賴的package包/類
public void destinationFieldOnDragDropped(DragEvent event) {
    Dragboard db = event.getDragboard();
    boolean success = false;
    if (db.hasString()) {
        model.destinationDirectoryProperty().set(new File(db.getString()));
        event.setDropCompleted(true);
    }
    if (db.hasFiles()) {
        model.destinationDirectoryProperty().set(db.getFiles().get(0));
        event.setDropCompleted(true);
    }
    event.consume();
}
 
開發者ID:abhishekmunie,項目名稱:Magic-Copier,代碼行數:14,代碼來源:MagicCopierPreferencesController.java


注:本文中的javafx.scene.input.Dragboard.hasString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。