• javafx style and cssFile


    public class EffectTest extends Application {
    
     public static void main(String[] args) {
        launch(args);
      }
    
      @Override
      public void start(Stage stage) {
        stage.setTitle("ComboBoxSample");
        Scene scene = new Scene(new Group(), 450, 250);
    
        TextField notification = new TextField();
    
        final ContextMenu contextMenu = new ContextMenu();
        contextMenu.setOnShowing((WindowEvent e) -> {
            System.out.println("showing");
        });
        contextMenu.setOnShown((WindowEvent e) -> {
            System.out.println("shown");
        });
    
        MenuItem item1 = new MenuItem("About");
        item1.setOnAction((ActionEvent e) -> {
            System.out.println("About");
        });
        MenuItem item2 = new MenuItem("Preferences");
        item2.setOnAction((ActionEvent e) -> {
            System.out.println("Preferences");
        });
        contextMenu.getItems().addAll(item1, item2);
    
        notification.setContextMenu(contextMenu);
      
        
        
        
        GridPane grid = new GridPane();
        grid.setVgap(4);
        grid.setHgap(10);
        grid.setPadding(new Insets(5, 5, 5, 5));
        grid.add(new Label("To: "), 0, 0);
        grid.add(notification, 2, 3);
        Text text = new Text();
            text.setId("fancytext");
            text.setStyle("#fancytext {-fx-fill: white;-fx-font: 120px Harlow; }");
            text.setX(20);
            text.setY(150);
            
            grid.add(text, 3, 2);
        
        final String cssDefault = "-fx-border-color: blue;
    "
                +"-fx-background-color: black;"
                    + "-fx-border-insets: 5;
    "
                    + "-fx-border- 3;
    "
                    + "-fx-border-style: dashed;
    ";
    //grid.setStyle("-fx-background-color: black;");
        
        
      
        
        
        grid.setStyle(cssDefault);
        Group root = (Group) scene.getRoot();
     
        
        root.getChildren().add(grid);
        
        
        
        
        
            scene.setFill(null);
            
            String cssFile1 = this.getClass().getResource("x.css").toExternalForm();
            String cssFile2 = this.getClass().getResource("Styles.css").toExternalForm();
            String cssFile3 = this.getClass().getResource("/cssStyles/base.css").toExternalForm();
            scene.getStylesheets().addAll(cssFile1, cssFile2, cssFile3);
        stage.setScene(scene);
        stage.show();
    
      }
      
    }
  • 相关阅读:
    arcgis连接oracle发布服务,提示数据未注册到服务器,手动注册服务器失败
    安装arcgis server时提示“应用程序无法启动,因为应用程序......或使用命令行sxstrace.exe”
    创建自定义地理(坐标)变换
    坐标系转换方式
    ArcSDE数据库、文件地理数据库和个人地理数据库的区别
    4D
    Oracle 11g中创建实例
    Oracle 10g客户端的安装和配置
    Oracle 11g服务端的安装和配置
    类装载器ClassLoader
  • 原文地址:https://www.cnblogs.com/rojas/p/4720957.html
Copyright © 2020-2023  润新知