本文整理汇总了Java中javafx.scene.image.ImageView.setOnDragDropped方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.setOnDragDropped方法的具体用法?Java ImageView.setOnDragDropped怎么用?Java ImageView.setOnDragDropped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.image.ImageView
的用法示例。
在下文中一共展示了ImageView.setOnDragDropped方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructContainer
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
headLbl = new Label("");
headLbl.setId("bold");
HomeButton backBtn = new HomeButton(getFXController(), "_Zur�ck");
AppButton newDoorBtn = new AppButton(txtNewTheme);
Image trashImg = new Image("views/pictures/Papierkorb.png");
ImageView trashImgView = new ImageView(trashImg);
BorderPane headLayout = new BorderPane(headLbl);
headLayout.setPadding(new Insets(0, 0, 25, 0));
doorLayout.setPadding(new Insets(10));
doorLayout.setAlignment(Pos.TOP_CENTER);
scroller.setMaxWidth(600);
scroller.setFitToWidth(true);
scroller.setPadding(new Insets(25));
ControlLayout conLay = new ControlLayout(backBtn, newDoorBtn, trashImgView);
MainLayout maLay = new MainLayout(scroller, headLayout, conLay);
newDoorBtn.setOnAction(e ->
{
newDoor();
});
trashImgView.setOnDragOver(event ->
{
if (event.getGestureSource() != trashImgView && event.getDragboard().hasString())
{
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
}
event.consume();
});
trashImgView.setOnDragDropped(event ->
{
Dragboard db = event.getDragboard();
boolean success = false;
if (db.hasString())
{
success = deleteDoor(db.getString());
}
event.setDropCompleted(success);
event.consume();
});
getFXController().getModel("cards").registerView(this);
return maLay;
}
示例2: constructContainer
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
public Parent constructContainer() {
headLbl = new Label("");
headLbl.setId("bold");
AppButton backBtn = new BackButton(getFXController(),"Zur�ck");
AppButton newDoorBtn = new AppButton(txtNewTheme);
Image trashImg = new Image("views/pictures/Papierkorb.png");
ImageView trashImgView = new ImageView(trashImg);
BorderPane headLayout = new BorderPane(headLbl);
headLayout.setPadding(new Insets(0, 0, 25, 0));
doorLayout.setPadding(new Insets(10));
doorLayout.setAlignment(Pos.TOP_CENTER);
scroller.setMaxWidth(600);
scroller.setFitToWidth(true);
scroller.setPadding(new Insets(25));
ControlLayout conLay = new ControlLayout(backBtn, newDoorBtn, trashImgView);
MainLayout maLay = new MainLayout(scroller, headLayout, conLay);
newDoorBtn.setOnAction(e ->
{
newDoor();
});
backBtn.setOnAction(e -> getFXController().showView("lernenselectionview"));
trashImgView.setOnDragOver(event ->
{
if (event.getGestureSource() != trashImgView && event.getDragboard().hasString())
{
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
}
event.consume();
});
trashImgView.setOnDragDropped(event ->
{
Dragboard db = event.getDragboard();
boolean success = false;
if (db.hasString())
{
success = deleteDoor(db.getString());
}
event.setDropCompleted(success);
event.consume();
});
getFXController().getModel("cards").registerView(this);
return maLay;
}
示例3: constructContainer
import javafx.scene.image.ImageView; //导入方法依赖的package包/类
@Override
public Parent constructContainer ()
{
doorLayout = new StandardVBox();
VerticalScroller scroLay = new VerticalScroller(doorLayout);
HomeButton homeBtn = new HomeButton(getFXController());
AppButton newDoorBtn = new AppButton(txtNewTheme);
AppButton renameBtn = new AppButton("Umbennen");
Image trashImg = new Image("views/pictures/Papierkorb.png");
ImageView trashImgView = new ImageView(trashImg);
ControlLayout conLay = new ControlLayout(homeBtn, newDoorBtn, renameBtn, trashImgView);
MainLayout maLay = new MainLayout(scroLay, conLay);
newDoorBtn.setOnAction(e ->
{
newDoor();
});
renameBtn.setOnAction(e ->
{
getFXController().setViewData("rename", "door" + Globals.SEPARATOR + "doors");
getFXController().showView("rename");
});
trashImgView.setOnDragOver(event ->
{
if (event.getGestureSource() != trashImgView && event.getDragboard().hasString())
{
event.acceptTransferModes(TransferMode.COPY_OR_MOVE);
}
event.consume();
});
trashImgView.setOnDragDropped(event ->
{
Dragboard db = event.getDragboard();
boolean success = false;
if (db.hasString())
{
success = deleteDoor(db.getString());
}
event.setDropCompleted(success);
event.consume();
});
getFXController().getModel("door").registerView(this);
return maLay;
}