Java Code Examples for javafx.scene.layout.StackPane#setBackground()

The following examples show how to use javafx.scene.layout.StackPane#setBackground() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Demo.java    From Enzo with Apache License 2.0 7 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane();
    pane.setBackground(new Background(new BackgroundFill(Color.DARKGRAY, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10, 10, 10, 10));
    pane.getChildren().add(control);

    Scene scene = new Scene(pane);

    stage.setTitle("VuMeter Demo");
    stage.setScene(scene);
    stage.show();

    timer.start();
    
    calcNoOfNodes(scene.getRoot());
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 2
Source File: DemoRadialBargraph.java    From Enzo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) throws Exception {
    StackPane pane = new StackPane();
    pane.setBackground(null);
    pane.setPadding(new Insets(5, 5, 5, 5));
    pane.getChildren().addAll(control);

    Scene scene = new Scene(pane, Color.WHITE);

    //scene.setFullScreen(true);

    stage.setTitle("RadialBargraph");
    stage.setScene(scene);
    stage.show();

    timer.start();

    calcNoOfNodes(scene.getRoot());
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 3
Source File: JFXDialog.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
private void initialize() {
    this.setVisible(false);
    this.getStyleClass().add(DEFAULT_STYLE_CLASS);
    this.transitionType.addListener((o, oldVal, newVal) -> {
        animation = getShowAnimation(transitionType.get());
    });

    contentHolder = new StackPane();
    contentHolder.setBackground(new Background(new BackgroundFill(Color.WHITE, new CornerRadii(2), null)));
    JFXDepthManager.setDepth(contentHolder, 4);
    contentHolder.setPickOnBounds(false);
    // ensure stackpane is never resized beyond it's preferred size
    contentHolder.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    this.getChildren().add(contentHolder);
    this.getStyleClass().add("jfx-dialog-overlay-pane");
    StackPane.setAlignment(contentHolder, Pos.CENTER);
    this.setBackground(new Background(new BackgroundFill(Color.rgb(0, 0, 0, 0.1), null, null)));
    // close the dialog if clicked on the overlay pane
    if (overlayClose.get()) {
        this.addEventHandler(MouseEvent.MOUSE_PRESSED, closeHandler);
    }
    // prevent propagating the events to overlay pane
    contentHolder.addEventHandler(MouseEvent.ANY, e -> e.consume());
}
 
Example 4
Source File: MainScene.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Creates the new ticker billboard
 */
public void createBillboard() {

	matrix = DotMatrixBuilder.create().prefSize(925, 54).colsAndRows(196, 11).dotOnColor(Color.rgb(255, 55, 0))
			.dotOffColor(Color.rgb(64, 64, 64)).dotShape(DotShape.ROUND).matrixFont(MatrixFont8x8.INSTANCE).build();

	billboard = new StackPane(matrix);
	// billboard.setPadding(new Insets(1));
	billboard.setBackground(
			new Background(new BackgroundFill(Color.rgb(20, 20, 20), CornerRadii.EMPTY, Insets.EMPTY)));
	// billboard.setBorder(new Border(new BorderStroke(Color.DARKCYAN,
	// BorderStrokeStyle.DOTTED, CornerRadii.EMPTY, BorderWidths.FULL)));
	dragNode = new DraggableNode(billboard, stage, 925, 54);

	dragNode.setCache(true);
	dragNode.setCacheShape(true);
	dragNode.setCacheHint(CacheHint.SPEED);
}
 
Example 5
Source File: MultiGaugeDemo.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(20));
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa MultiGauge");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
 
Example 6
Source File: Test.java    From medusademo with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(50, 50, 50), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Test");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");

}
 
Example 7
Source File: Test.java    From Medusa with Apache License 2.0 6 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(gauge);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.web("#10163a"), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Test");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");

    timer.start();
}
 
Example 8
Source File: Demo.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(matrix);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(20, 20, 20), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("DotMatrix");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 9
Source File: WaitIndicator.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public WaitIndicator(Stage stage) {	
  	this.stage = stage;
  	//stage = new Stage();
  	indicator = new CircularProgressIndicator();
      StackPane pane = new StackPane(indicator);
      
//stackPane.setScaleX(1.2);
//stackPane.setScaleY(1.2);

      pane.setBackground(Background.EMPTY);
      pane.setStyle(
   		   //"-fx-border-style: none; "
   		   //"-fx-background-color: #231d12; "
      			"-fx-background-color: transparent; "
      			+ 
      			"-fx-background-radius: 1px;"
   		   );
      
      Scene scene = new Scene(pane, 128, 128, true);

scene.setFill(Color.TRANSPARENT);

stage.requestFocus();
      stage.initStyle(StageStyle.TRANSPARENT);
      stage.setTitle("Circular Progress Indicator");
      stage.setScene(scene);
      stage.toFront();
      stage.show();
      
      indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  }
 
Example 10
Source File: WaitIndicatorDemo.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public void start(Stage stage) {
 // public WaitIndicatorDemo(Stage stage) {	
  	this.stage = stage;
  	//stage = new Stage();
  	indicator = new CircularProgressIndicator();
      StackPane pane = new StackPane(indicator);
      
//stackPane.setScaleX(1.2);
//stackPane.setScaleY(1.2);

      pane.setBackground(Background.EMPTY);
      pane.setStyle(
   		   //"-fx-border-style: none; "
   		   //"-fx-background-color: #231d12; "
      			"-fx-background-color: transparent; "
      			+ 
      			"-fx-background-radius: 1px;"
   		   );
      
      Scene scene = new Scene(pane, 128, 128, true);

scene.setFill(Color.TRANSPARENT);

stage.requestFocus();
      stage.initStyle(StageStyle.TRANSPARENT);
      stage.setTitle("Circular Progress Indicator");
      stage.setScene(scene);
      stage.toFront();
      stage.show();
      
      indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  }
 
Example 11
Source File: WaitIndicator.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
public WaitIndicator(Stage stage) {	
  	this.stage = stage;
  	//stage = new Stage();
  	indicator = new CircularProgressIndicator();
      StackPane pane = new StackPane(indicator);
      
//stackPane.setScaleX(1.2);
//stackPane.setScaleY(1.2);

      pane.setBackground(Background.EMPTY);
      pane.setStyle(
   		   //"-fx-border-style: none; "
   		   //"-fx-background-color: #231d12; "
      			"-fx-background-color: transparent; "
      			+ 
      			"-fx-background-radius: 1px;"
   		   );
      
      Scene scene = new Scene(pane, 128, 128, true);

scene.setFill(Color.TRANSPARENT);

stage.requestFocus();
      stage.initStyle(StageStyle.TRANSPARENT);
      stage.setTitle("Circular Progress Indicator");
      stage.setScene(scene);
      stage.toFront();
      stage.show();
      
      indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
  }
 
Example 12
Source File: SelectableTitledPaneDemo.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override 
	public void start(Stage stage) {
	        
		  List<String> list = new ArrayList<>(Arrays.asList(strs));
		  	  
//		  ComboBox<?> combo = ComboBoxBuilder.create().
//		            prefWidth(150).
//		            //items(list).
//		            items(FXCollections.observableArrayList(list)).//"aa", "bb", "bb")); 		  
//		            //promptText(resourceBundle.getString("search.prompt.owner")).
//		            promptText("Choice").
//		            build();
		 
		  ComboBox<String> combo = new ComboBox<String>();
		  combo.setItems(FXCollections.observableArrayList(list));
		  combo.setPrefWidth(150);
		  combo.setPromptText("Choice");

		  //combo.setItems((ObservableList<?>) FXCollections.observableArrayList(list));//"aa", "bb", "bb"));
		  
		  
		  SelectableTitledPane ownerParams = new SelectableTitledPane(
				  //resourceBundle.getString("search.checkbox.owner"),
				  "checkbox",
				  combo);

	        
	        StackPane pane = new StackPane();
	        pane.setBackground(null);
	        pane.setPadding(new Insets(10, 10, 10, 10));
	        pane.getChildren().addAll( ownerParams);

	        Scene scene = new Scene(pane);
	        stage.setScene(scene);
	        stage.show();
	    }
 
Example 13
Source File: JFXFlashTest.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    final StackPane pane = new StackPane();
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(54, 54, 54), CornerRadii.EMPTY, Insets.EMPTY)));
    final Scene scene = new Scene(pane, 1024, 768);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
Example 14
Source File: Demo.java    From Enzo with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane();
    pane.setPadding(new Insets(5, 5, 5, 5));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(70, 70, 70), CornerRadii.EMPTY, Insets.EMPTY)));
    pane.getChildren().setAll(signalTower);

    Scene scene = new Scene(pane);

    stage.setTitle("SignalTower");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 15
Source File: SmoothedChart.java    From OEE-Designer with MIT License 5 votes vote down vote up
public void setSymbolFill(final Series<X, Y> SERIES, final Background SYMBOL_BACKGROUND) {
    if (!getData().contains(SERIES)) { return; }
    for (XYChart.Data<X, Y> data : SERIES.getData()) {
        StackPane stackPane = (StackPane) data.getNode();
        if (null == stackPane) { continue; }
        stackPane.setBackground(SYMBOL_BACKGROUND);
    }
}
 
Example 16
Source File: FuelGauge.java    From medusademo with Apache License 2.0 5 votes vote down vote up
@Override public void init() {
    fuelIcon = new Region();
    fuelIcon.getStyleClass().setAll("fuel-icon");

    gauge = GaugeBuilder.create()
                        .skinType(SkinType.HORIZONTAL)
                        .prefSize(500, 250)
                        .knobColor(Color.rgb(0, 0, 0))
                        .foregroundBaseColor(Color.rgb(249, 249, 249))
                        .animated(true)
                        .shadowsEnabled(true)
                        .valueVisible(false)
                        //.title("FUEL")
                        .needleColor(Color.web("0xEF2F06"))
                        //.needleColor(Color.rgb(255, 10, 1))
                        .needleShape(NeedleShape.ROUND)
                        .needleSize(NeedleSize.THICK)
                        .minorTickMarksVisible(false)
                        .mediumTickMarksVisible(false)
                        //.majorTickMarkType(TickMarkType.TRIANGLE)
                        .sectionsVisible(true)
                        .sections(new Section(0, 0.2, Color.rgb(255, 10, 1)))
                        .minValue(0)
                        .maxValue(1)
                        .angleRange(90)
                        .customTickLabelsEnabled(true)
                        .customTickLabels("E", "", "", "", "", "1/2", "", "", "", "", "F")
                        .build();

    pane = new StackPane(fuelIcon, gauge);
    pane.setPadding(new Insets(10));
    LinearGradient gradient = new LinearGradient(0, 0, 0, pane.getLayoutBounds().getHeight(),
                                                 false, CycleMethod.NO_CYCLE,
                                                 new Stop(0.0, Color.rgb(38, 38, 38)),
                                                 new Stop(1.0, Color.rgb(15, 15, 15)));
    pane.setBackground(new Background(new BackgroundFill(gradient, CornerRadii.EMPTY, Insets.EMPTY)));
}
 
Example 17
Source File: Main.java    From worldfx with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(world);
    pane.setBackground(new Background(new BackgroundFill(world.getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);
    //scene.getStylesheets().add(Main.class.getResource("custom-styles.css").toExternalForm());

    stage.setTitle("World Map");
    stage.setScene(scene);
    stage.show();

    //world.zoomToCountry(Country.DE);
    //world.zoomToRegion(europeanUnion);
    world.zoomToRegion(BusinessRegion.EU);
}
 
Example 18
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(lineChart);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.web("#293C47"), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Line Chart");
    stage.setScene(scene);
    stage.show();
}
 
Example 19
Source File: MatrixPlotTest.java    From charts with Apache License 2.0 5 votes vote down vote up
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(pixelMatrix);
    pane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("MatrixPlot");
    stage.setScene(scene);
    stage.show();

    timer.start();
}
 
Example 20
Source File: SymbolRepresentation.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected StackPane createJFXNode ( ) throws Exception {

    autoSize = model_widget.propAutoSize().getValue();
    symbol = getDefaultSymbol();

    StackPane symbolPane = new StackPane();

    indexLabelBackground.setStroke(Color.LIGHTGRAY.deriveColor(0.0, 1.0, 1.0, 0.75));
    indexLabelBackground.setVisible(model_widget.propShowIndex().getValue());

    indexLabel.setAlignment(Pos.CENTER);
    indexLabel.setFont(Font.font(indexLabel.getFont().getFamily(), FontWeight.BOLD, 16));
    indexLabel.setTextFill(Color.WHITE);
    indexLabel.setVisible(model_widget.propShowIndex().getValue());
    indexLabel.textProperty().bind(Bindings.convert(imageIndexProperty()));

    symbolPane.getChildren().addAll(getSymbolNode(), indexLabelBackground, indexLabel);

    if ( model_widget.propTransparent().getValue() ) {
        symbolPane.setBackground(null);
    } else {
        symbolPane.setBackground(new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), CornerRadii.EMPTY, Insets.EMPTY)));
    }

    enabled = model_widget.propEnabled().getValue();

    Styles.update(symbolPane, Styles.NOT_ENABLED, !enabled);

    initialIndexChanged(null, null, null);
    symbolChanged(null, null, null);

    return symbolPane;

}