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