zoukankan      html  css  js  c++  java
  • javafx点击鼠标出现弹窗,demo

    在学习javafx的过程中,不知道怎么出现一个弹窗,如,点击一个按钮出现一个修改信息的列表选项

    终于在javafx文档示例中发现了类似的东西,记录一下,备忘
    package demo9_button;

    import javafx.application.Application;
    import static javafx.application.Application.launch;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;


    public class Test extends Application {
        
        @Override
        public void start(Stage primaryStage) {
            //button一个----------------------------------   
           final Button b2 = new Button("  O K  ");
            
            b2.setOnAction(new EventHandler<ActionEvent>() {//鼠标点击
                public void handle(ActionEvent e) {
                       Stage stage = new Stage();
                       Label l = new Label("显示出来了");
                       Scene s = new Scene(l,200,100);
                       stage.setScene(s);
                       stage.show();
                }
            });
            StackPane root = new StackPane();
            root.getChildren().add(b2);
            
            Scene scene = new Scene(root, 500, 350);
            
            primaryStage.setTitle("Hello World!");
            primaryStage.setScene(scene);
            primaryStage.show();
        }
        public static void main(String[] args) {
            launch(args);
        }
    }

  • 相关阅读:
    linux下mysql区分大小写的内容
    jar包 pom
    项目的考虑
    webservice
    MySQL外键设置中的的 Cascade、NO ACTION、Restrict、SET NULL
    JVM参数最佳实践:元空间的初始大小和最大大小
    JVM问题排查工具:Serviceability-Agent介绍
    Spring Boot 2.x基础教程:构建RESTful API与单元测试
    彻底搞懂JVM类加载器:基本概念
    如何解决90%的问题?10位阿里大牛公布方法
  • 原文地址:https://www.cnblogs.com/xiaoliu66007/p/3314046.html
Copyright © 2011-2022 走看看