FULL PRODUCT VERSION :
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+167)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+167, mixed mode)
A DESCRIPTION OF THE PROBLEM :
the method setStyle("-fx-background-value: color") of a JavaFX Button sets, in addition to the background color, also the corner radii (at a uniform value of 3) and the insets.
REGRESSION. Last worked in version 8u131
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1- Create a new Button()
2- Set a background using the setBackground() method
for example: button.setBackground(new BackgroundFill(
Color.WHITE, new CornerRadii(50), new Insets(0)));
3-Set a different background color style using the setStyle() method
for example: button.setStyle("-fx-background-color: red;");
4-Add the button to the scene graph
5-Add a on action event callback, using the setOnAction() method, to the button and inside the callback function print the background color, radii and insets
6-Run the program and click on the button
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Color: 0xff0000ff
radii: CornerRadii [uniform radius = 50.0]
insets: Insets [top=0.0, right=0.0, bottom=0.0, left=0.0]
ACTUAL -
color: 0xff0000ff
radii: CornerRadii [uniform radius = 3.0]
insets: Insets [top=-0.2, right=-0.2, bottom=-0.2, left=-0.2]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("Sample.fxml"));
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
Pane pane=new Pane();
Button b=new Button();
b.setBackground(new Background(new BackgroundFill(
Color.WHITE, new CornerRadii(50), new Insets(0))));
b.setStyle("-fx-background-color: red;");
b.setOnAction(event -> {
BackgroundFill bf=b.getBackground().getFills().get(0);
System.out.println(
"color: "+bf.getFill()+"\n"+
"radii: "+bf.getRadii()+"\n"+
"insets: "+bf.getInsets());
});
pane.getChildren().addAll(b);
root.getChildren().add(pane);
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+167)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+167, mixed mode)
A DESCRIPTION OF THE PROBLEM :
the method setStyle("-fx-background-value: color") of a JavaFX Button sets, in addition to the background color, also the corner radii (at a uniform value of 3) and the insets.
REGRESSION. Last worked in version 8u131
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1- Create a new Button()
2- Set a background using the setBackground() method
for example: button.setBackground(new BackgroundFill(
Color.WHITE, new CornerRadii(50), new Insets(0)));
3-Set a different background color style using the setStyle() method
for example: button.setStyle("-fx-background-color: red;");
4-Add the button to the scene graph
5-Add a on action event callback, using the setOnAction() method, to the button and inside the callback function print the background color, radii and insets
6-Run the program and click on the button
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Color: 0xff0000ff
radii: CornerRadii [uniform radius = 50.0]
insets: Insets [top=0.0, right=0.0, bottom=0.0, left=0.0]
ACTUAL -
color: 0xff0000ff
radii: CornerRadii [uniform radius = 3.0]
insets: Insets [top=-0.2, right=-0.2, bottom=-0.2, left=-0.2]
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
BorderPane root = (BorderPane)FXMLLoader.load(getClass().getResource("Sample.fxml"));
Scene scene = new Scene(root,400,400);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
Pane pane=new Pane();
Button b=new Button();
b.setBackground(new Background(new BackgroundFill(
Color.WHITE, new CornerRadii(50), new Insets(0))));
b.setStyle("-fx-background-color: red;");
b.setOnAction(event -> {
BackgroundFill bf=b.getBackground().getFills().get(0);
System.out.println(
"color: "+bf.getFill()+"\n"+
"radii: "+bf.getRadii()+"\n"+
"insets: "+bf.getInsets());
});
pane.getChildren().addAll(b);
root.getChildren().add(pane);
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
---------- END SOURCE ----------