<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      javaFx在Stage使用UNDECORATED布局時的窗體拖拽實現

      package ch04;
      
      
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;
      import javafx.stage.StageStyle;
      public class DraggingStage extends Application {
      
      
      	private Stage stage;
      	// 點擊鼠標時的x坐標值
      	private double dragOffsetX;
      	// 點擊鼠標時的y坐標值
      	private double dragOffsetY;
      	public static void main(String[] args) {
      		Application.launch(DraggingStage.class, args);
      	}
      	@Override
      	public void start(Stage primaryStage) {
      		// Store the stage reference in the instance variable to
      		// use it in the mouse pressed event handler later.
      		this.stage = primaryStage;
      		Label msgLabel = new Label("Press the mouse button and drag.");
      		Button closeButton = new Button("Close");
      		// closeButton.setOnAction(e -> stage.close());
      		closeButton.setOnAction(e -> primaryStage.close());
      		VBox root = new VBox();
      		root.getChildren().addAll(msgLabel, closeButton);
      		Scene scene = new Scene(root, 300, 200);
      		// Set lambda of mouse pressed and dragged even handlers for the scene
      		scene.setOnMousePressed((ev) -> handleMousePressed(ev));
      		// scene.setOnMousePressed(this::handleMousePressed(e));
      		scene.setOnMouseDragged(e -> handleMouseDragged(e));
      		stage.setScene(scene);
      		stage.setTitle("Moving a Stage");
      		stage.initStyle(StageStyle.UNDECORATED);
      		stage.show();
      	}
      	/**
      	@class DraggingStage
      	@date 2020/5/24
      	@author qiaowei
      	@version 1.0
      	@brief 點擊鼠標時觸發事件
      	@param e 鼠標事件
      	*/
      	protected void handleMousePressed(MouseEvent e) {
      		// Store the mouse x and y coordinates with respect to the
      		// stage in the reference variables to use them in the drag event
      		// 點擊鼠標時,獲取鼠標在窗體上點擊時相對應窗體左上角的偏移
      		this.dragOffsetX = e.getScreenX() - stage.getX();
      		this.dragOffsetY = e.getScreenY() - stage.getY();
      	}
      	
      	protected void handleMouseDragged(MouseEvent e) {
      		// Move the stage by the drag amount
      		// 拖動鼠標后,獲取鼠標相對應顯示器坐標減去鼠標相對窗體的坐標,并將其設置為窗體在顯示器上的坐標
      		stage.setX(e.getScreenX() - this.dragOffsetX);
      		stage.setY(e.getScreenY() - this.dragOffsetY);
      	}
      
      }
      
      //參:https://blog.csdn.net/weixin_34695463/article/details/114729954
      posted @ 2022-11-20 21:36  涂山樹下  閱讀(166)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产又爽又黄又刺激的视频| 国产蜜臀一区二区在线播放| 人妻丝袜AV中文系列先锋影音| 日本三级香港三级三级人妇久| 日韩精品一区二区亚洲专区| 麻豆精品一区二区综合av| 动漫av纯肉无码av在线播放| 亚洲最大成人在线播放| 性视频一区| 日韩放荡少妇无码视频| 在线视频中文字幕二区| 亚洲欧美在线观看品| 人人妻人人澡人人爽| 熟妇的味道hd中文字幕| 国产成人亚洲综合图区| 91人妻无码成人精品一区91| 亚洲最大成人网色| 老熟妇欲乱一区二区三区| 18禁亚洲一区二区三区| 少妇av一区二区三区无码| 青阳县| 国产在线中文字幕精品| ww污污污网站在线看com| 国产初高中生在线视频| 亚洲精品一区二区18禁| 国产一级小视频| 国产三级黄色片在线观看| 久热这里只有精品12| 亚洲嫩模喷白浆在线观看| 精品日韩亚洲av无码| 大战丰满无码人妻50p| 亚洲精品揄拍自拍首页一| 亚洲午夜无码av毛片久久| 亚洲av一区二区在线看| 国产二区三区不卡免费| 中文人妻AV大区中文不卡| 国产精品一区二区传媒蜜臀| 视频一区视频二区在线视频| 国产91麻豆精品成人区| 亚洲中文字幕国产综合| 亚洲天堂在线观看完整版|