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


Java Scene.setFill方法代码示例

本文整理汇总了Java中javafx.scene.Scene.setFill方法的典型用法代码示例。如果您正苦于以下问题:Java Scene.setFill方法的具体用法?Java Scene.setFill怎么用?Java Scene.setFill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.Scene的用法示例。


在下文中一共展示了Scene.setFill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
  this.stage = stage;

  stage.initStyle(StageStyle.TRANSPARENT);

  VBox box = new VBox(20);
  box.setMaxWidth(Region.USE_PREF_SIZE);
  box.setMaxHeight(Region.USE_PREF_SIZE);
  box.setBackground(Background.EMPTY);
  String style = "-fx-background-color: rgba(255, 255, 255, 0.5);";
  box.setStyle(style);

  box.setPadding(new Insets(50));
  BorderPane root = new BorderPane(box);
  root.setStyle(style);
  root.setBackground(Background.EMPTY);
  Scene scene = new Scene(root);
  scene.setFill(Color.TRANSPARENT);
  stage.setScene(scene);

  ImageView splashView = new ImageView(splashImage);
  box.getChildren().addAll(splashView, new Label("ST Verification Studio is loading.."));
  stage.show();
  Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();
  stage.setX((primScreenBounds.getWidth() - stage.getWidth()) / 2);
  stage.setY((primScreenBounds.getHeight() - stage.getHeight()) / 2);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:29,代码来源:StvsPreloader.java

示例2: start

import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    scene.setFill(Color.ALICEBLUE);
    stage.setScene(scene);
    stage.show();

    stage.setTitle("ChoiceBox Sample");
    stage.setWidth(300);
    stage.setHeight(200);
  
    label.setFont(Font.font("Arial", 25));
    label.setLayoutX(40);

   final String[] greetings = new String[]{"Hello", "Hola", "Привет", "你好",
       "こんにちは"};
   final ChoiceBox cb = new ChoiceBox(FXCollections.observableArrayList(
       "English", "Español", "Русский", "简体中文", "日本語")
   );
                                 
   cb.getSelectionModel().selectedIndexProperty().addListener(
       (ObservableValue<? extends Number> ov,
            Number old_val, Number new_val) -> {
                label.setText(greetings[new_val.intValue()]);            
    });
         
    cb.setTooltip(new Tooltip("Select the language"));
    cb.setValue("English");
    HBox hb = new HBox();
    hb.getChildren().addAll(cb, label);
    hb.setSpacing(30);
    hb.setAlignment(Pos.CENTER);
    hb.setPadding(new Insets(10, 0, 0, 10));

    ((Group) scene.getRoot()).getChildren().add(hb);
    
   
   
    
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:41,代码来源:ChoiceBoxSample.java

示例3: start

import javafx.scene.Scene; //导入方法依赖的package包/类
public void start(Stage primaryStage) {

        canvas = new GridPane();
        canvas.setPrefSize(800,800);
        canvas.setGridLinesVisible(true);
        final int numCols = 9 ;
        final int numRows = 8 ;
        for (int i = 0; i < numCols; i++) {
            ColumnConstraints colConst = new ColumnConstraints();
            colConst.setPercentWidth(100.0 / numCols);
            canvas.getColumnConstraints().add(colConst);
        }
        for (int i = 0; i < numRows; i++) {
            RowConstraints rowConst = new RowConstraints();
            rowConst.setPercentHeight(100.0 / numRows);
            canvas.getRowConstraints().add(rowConst);
        }


        scene = new Scene(canvas, 800, 800);
        primaryStage.setScene(scene);
        bubble = new Bubble(scene);
        primaryStage.show();

        scene.setFill(createGridPattern());


    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:29,代码来源:Circles_handler2.java

示例4: Exe

import javafx.scene.Scene; //导入方法依赖的package包/类
void Exe(int i) {
    if(i==1) {
        warnmesse="プレイ開始から5分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==2) {
        warnmesse="プレイ開始から10分経過しました\n混雑している場合は次の人に\n交代してください";
        fontsize=25;
    }else if(i==-1) {
    	warnmesse="user timer is reset";
    	fontsize=35;
    }

    final Stage primaryStage = new Stage(StageStyle.TRANSPARENT);
    primaryStage.initModality(Modality.NONE);
    final StackPane root = new StackPane();

    final Scene scene = new Scene(root, 350, 140);
    scene.setFill(null);

    final Label label = new Label(warnmesse);
    label.setFont(new Font("Arial", fontsize));
    BorderPane borderPane = new BorderPane();
    borderPane.setCenter(label);
    borderPane.setStyle("-fx-background-radius: 10;-fx-background-color: rgba(0,0,0,0.3);");

    root.getChildren().add(borderPane);

    final Rectangle2D d = Screen.getPrimary().getVisualBounds();
    primaryStage.setScene(scene);
    primaryStage.setAlwaysOnTop(true);
    primaryStage.setX(d.getWidth()-350);
    primaryStage.setY(d.getHeight()-300);

    primaryStage.show();

    final Timeline timer = new Timeline(new KeyFrame(Duration.seconds(CLOSE_SECONDS), (ActionEvent event) -> primaryStage.close()));
    timer.setCycleCount(Timeline.INDEFINITE);
    timer.play();
}
 
开发者ID:chrootRISCassembler,项目名称:CapsLock,代码行数:40,代码来源:OverLayWindow.java

示例5: start

import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
	public void start(Stage stage) {
		stage.setTitle("Vokabeltrainer");
        Scene scene = new Scene(new VBox(), 400, 350);
        scene.setFill(Color.OLDLACE);
 
        MenuBar menuBar = new MenuBar();
 
        // --- Menu File
        Menu menuFile = new Menu("Vokabeln");
        
        MenuItem sample = new MenuItem("Sample");
        sample.setOnAction(new EventHandler<ActionEvent>() {
			@Override
			public void handle(ActionEvent event) {
//				Do stuff here
			}
		});
        
        menuFile.getItems().add(sample);
 
        // --- Menu Edit
        Menu menuEdit = new Menu("Abfragemodus");
 
        // --- Menu View
        Menu menuView = new Menu("Statistik");
 
        menuBar.getMenus().addAll(menuFile, menuEdit, menuView);
 
 
        ((VBox) scene.getRoot()).getChildren().addAll(menuBar);
 
        stage.setScene(scene);
        stage.show();
	}
 
开发者ID:dunkelziffer,项目名称:Vokabeltrainer,代码行数:36,代码来源:Main.java

示例6: createBrowser

import javafx.scene.Scene; //导入方法依赖的package包/类
private void createBrowser() {
    Platform.setImplicitExit(false);
    if( null == browser ) {
        WebView view = new WebView();
        initBrowser( view );
        issue217410Hack(view);

        browser = view;
        INIT_LOCK.release();
    }

    if( null != container ) {
        BorderPane pane = new BorderPane();
        pane.setCenter( browser );
        Scene scene = new Scene( pane );
        scene.setFill( getSceneFillColor() );
        container.setScene( scene );
    }

    if( null != urlToLoad ) {
        _setURL( urlToLoad );
        urlToLoad = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:WebBrowserImpl.java

示例7: start

import javafx.scene.Scene; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
    Config.initialize();
    Group root = new Group();
    mainFrame = new MainFrame(root);
    stage.setTitle("Brick Breaker");
    stage.setResizable(false);
    stage.setWidth(Config.SCREEN_WIDTH + 2*Config.WINDOW_BORDER);
    stage.setHeight(Config.SCREEN_HEIGHT+ 2*Config.WINDOW_BORDER + Config.TITLE_BAR_HEIGHT);
    Scene scene = new Scene(root);
    scene.setFill(Color.BLACK);
    stage.setScene(scene);
    mainFrame.changeState(MainFrame.SPLASH);
    stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:Main.java

示例8: makeText

import javafx.scene.Scene; //导入方法依赖的package包/类
private static void makeText(Stage ownerStage, String toastMsg, int toastDelay) {
    Stage toastStage = new Stage();
    toastStage.initOwner(ownerStage);
    toastStage.setResizable(false);
    toastStage.initStyle(StageStyle.TRANSPARENT);

    Text text = new Text(toastMsg);
    text.setFont(Font.font("Verdana", 20));
    text.setFill(Color.BLACK);

    StackPane root = new StackPane(text);
    root.setStyle("-fx-background-radius: 20; -fx-background-color: rgba(255, 255, 255, 0.9); -fx-padding: 20px;");
    root.setOpacity(0);

    Scene scene = new Scene(root);
    scene.setFill(Color.TRANSPARENT);
    toastStage.setScene(scene);
    toastStage.show();

    Timeline fadeInTimeline = new Timeline();
    KeyFrame fadeInKey1 = new KeyFrame(Duration.millis(200), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 1));
    fadeInTimeline.getKeyFrames().add(fadeInKey1);
    fadeInTimeline.setOnFinished((ae) -> new Thread(() -> {
        try {
            Thread.sleep(toastDelay);
        } catch (InterruptedException e) {

            e.printStackTrace();
        }
        Timeline fadeOutTimeline = new Timeline();
        KeyFrame fadeOutKey1 = new KeyFrame(Duration.millis(500), new KeyValue(toastStage.getScene().getRoot().opacityProperty(), 0));
        fadeOutTimeline.getKeyFrames().add(fadeOutKey1);
        fadeOutTimeline.setOnFinished((aeb) -> toastStage.close());
        fadeOutTimeline.play();
    }).start());
    fadeInTimeline.play();
}
 
开发者ID:nwg-piotr,项目名称:EistReturns,代码行数:38,代码来源:Utils.java

示例9: createScene

import javafx.scene.Scene; //导入方法依赖的package包/类
/**
 * create the Scene set sceneBounds as a side effect.
 * 
 * @return the scene
 */
public Scene createScene() {
  setRoot(new VBox());
  int screenPercent;
  try {
    prefs = Preferences.getInstance();
    screenPercent = prefs.getScreenPercent();
  } catch (Exception e) {
    screenPercent = 100;
  }
  sceneBounds = super.getSceneBounds(screenPercent, 2, 3);
  Scene newScene = new Scene(getRoot(), sceneBounds.getWidth(),
      sceneBounds.getHeight());
  newScene.setFill(Color.OLDLACE);
  return newScene;
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:21,代码来源:JavaFXDisplay.java

示例10: DataImportDialog

import javafx.scene.Scene; //导入方法依赖的package包/类
public DataImportDialog(Window owner, FinancialMarket fm, TatConfig config) {
       super();
       this.fm = fm;
       this.config = config;
       setResizable(false);
       initStyle(StageStyle.DECORATED);
       initOwner(owner);
       setTitle("Financial Market Import");
       initModality(Modality.APPLICATION_MODAL);
       Image appIcon = new Image("icon/IMPORT_MARKET_DATA.png");
       getIcons().add(appIcon);
       root = new Group();
       Scene scene = new Scene(root, 500, 440, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk5.jpg"));
       scene.setFill(pattern);
       setScene(scene);
       initGui();
       //Add listener to exit when press Esc key
       addEventHandler(KeyEvent.KEY_PRESSED, (KeyEvent event) -> {
           if (KeyCode.ESCAPE == event.getCode()) {
               DataImportDialog.this.close();
           }
           if (KeyCode.ENTER == event.getCode()) {
               doImport();
           }
       });
       
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:31,代码来源:DataImportDialog.java

示例11: makeErrorGUI

import javafx.scene.Scene; //导入方法依赖的package包/类
/**
    * Make a Error Dialog
    * @return BorderPane
    */
   public void makeErrorGUI() {
       root = new Group();
       Scene scene = new Scene(root, 360, 185, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
       scene.setFill(pattern);
       setTitle("Error");
       setScene(scene);
       Image appIcon = new Image("icon/ERROR.png");
       getIcons().add(appIcon);
       BorderPane bp = new BorderPane();

       textArea = new TextArea(message);
       textArea.setEditable(false);
       textArea.setWrapText(true);
       textArea.setMaxWidth(320);
       textArea.setMaxHeight(130);
       HBox hBox = new HBox();
       hBox.setSpacing(5);
       hBox.setPadding(new Insets(5,0,0,0));
       hBox.setAlignment(Pos.BOTTOM_RIGHT);
       hBox.getChildren().addAll(openLogButton,okButton);
       bp.setCenter(textArea);
       bp.setBottom(hBox);
       root.getChildren().add(bp);
       sizeToScene();
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:33,代码来源:TatMessageBox.java

示例12: start

import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	stage.setTitle("Tree View Sample");
	final Scene scene = new Scene(getBox(), 400, 300);
	scene.setFill(Color.LIGHTGRAY);
	stage.setScene(scene);
	stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:DynamicTreeViewSample.java

示例13: start

import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
	VBox box = getVBox();

	stage.setTitle("Tree View Sample");
	final Scene scene = new Scene(box, 400, 300);
	scene.setFill(Color.LIGHTGRAY);
	stage.setScene(scene);
	stage.show();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:LabelSample.java

示例14: makeInfoGUI

import javafx.scene.Scene; //导入方法依赖的package包/类
/**
    * Make Information Dialog
    * @return BorderPane
    */
   public void makeInfoGUI() {
       root = new Group();
       Scene scene = new Scene(root, 360, 185, Color.WHITE);
       ImagePattern pattern = new ImagePattern(new Image("icon/bk2.jpg"));
       scene.setFill(pattern);
       setTitle("Information");
       setScene(scene);
       Image appIcon = new Image("icon/INFO.png");
       getIcons().add(appIcon);
       BorderPane bp = new BorderPane();

       textArea = new TextArea(message);
       textArea.setEditable(false);
       textArea.setWrapText(true);
       textArea.setMaxWidth(320);
       textArea.setMaxHeight(130);
       HBox hBox = new HBox();
       hBox.setSpacing(5);
       hBox.setPadding(new Insets(5,0,0,0));
       hBox.setAlignment(Pos.BOTTOM_RIGHT);
       hBox.getChildren().addAll(okButton);
       bp.setCenter(textArea);
       bp.setBottom(hBox);
       root.getChildren().add(bp);
       sizeToScene();
       setX(owner.getX() + Math.abs(owner.getWidth() - scene.getWidth()) / 2.0);
setY(owner.getY() + Math.abs(owner.getHeight() - scene.getHeight()) / 2.0);
   }
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:33,代码来源:TatMessageBox.java

示例15: NewTaskWindow

import javafx.scene.Scene; //导入方法依赖的package包/类
/**
 * Builds the window and add events.
 * @throws IOException 
 */
public NewTaskWindow() throws IOException {
    super();

    FXMLLoader fxmlLoader = new FXMLLoader(
            getClass().getResource("/FXML/newTask.fxml"));
    Parent root = (Parent) fxmlLoader.load();
    taskController
            = (NewTaskController) fxmlLoader.getController();
    taskController.applyGUIMods();
    
    Scene scene = new Scene(root);
    scene.setFill(javafx.scene.paint.Color.TRANSPARENT);
    setScene(scene);
    setTitle("Add a task");
    setResizable(false);
    initStyle(StageStyle.TRANSPARENT);

    this.wantsToAdd = false;
    //After pressing 'Enter', closes this window (which returns the value)
    scene.setOnKeyPressed((final KeyEvent keyEvent) -> {
        if (keyEvent.getCode() == KeyCode.ENTER) {
            this.wantsToAdd = true;
            this.close();
        } else if (keyEvent.getCode() == KeyCode.ALT) {
            //Using alt key since tab doesn't work
            taskController.showDetails();
        } else if (keyEvent.getCode() == KeyCode.ESCAPE) {
            this.close();
        }
    });

    //Not focusing the window means closing it
    focusedProperty().addListener((obs, wasFocused, isNowFocused) -> {
        if (!isNowFocused) {
            close();
        }
    });
}
 
开发者ID:Soheibooo,项目名称:EMBER,代码行数:43,代码来源:NewTaskWindow.java


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