当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.setOnDragDropped方法代码示例

本文整理汇总了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;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:56,代码来源:DoorView_withoutDesign.java

示例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;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:57,代码来源:DoorView.java

示例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;
}
 
开发者ID:CoffeeCodeSwitzerland,项目名称:Lernkartei_2017,代码行数:55,代码来源:DoorView_old.java


注:本文中的javafx.scene.image.ImageView.setOnDragDropped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。