BackGround_BackgroundFill1
  • Pane
  • BackgroundFill fillGreen =
    new BackgroundFill(Color.GREEN, new CornerRadii(4), new Insets(0));
  • Background bg = new Background(fillGreen);
Code:

package javafxtemplate1;
//Recursion_BindContent_ListView1
//textProperty().addListener Listview Label
import javafx.geometry.Insets;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;


/**
*
* @author Manas9
*/
public class JavaFXTemplate1 extends Application {

Label label1 =new Label("L1");
Label label2 =new Label("L1");
Scene scene;
Pane root = new Pane();
//FlowPane pane1 = new FlowPane();
HBox hb1 = new HBox(10); HBox hb2 = new HBox(10);
String str1; Color color1 ;//= new Color();
@Override
public void start(Stage primaryStage) throws Exception {
BackgroundFill fillGreen =
new BackgroundFill(Color.GREEN, new CornerRadii(4), new Insets(0));
Background bg = new Background(fillGreen);

root.setPrefSize(250,100);
root.setBackground(bg);
label1.setText(root.getClass().toString());
//
root.getChildren().add(label1);
Scene scene = new Scene(root, 300, 250);

primaryStage.setTitle(" Background Fill");
primaryStage.setScene(scene);
primaryStage.show();
}

//


public static void main(String[] args) {
launch(args);
}

}

runtime displays