-
Bug
-
Resolution: Fixed
-
P4
-
8
-
Windows7 64bits and Linux 64bits with Java8 beta79
When you define, with css styles, a pane that contains other elemente and that elements are defined with css styles too, if you modify the border style of the pane, all of the contained elements reset they style while the refresh style it is applying.
Example code:
@Override
public void start(Stage primaryStage) throws FocucsException{
Group root=new Group();
Scene scene = new Scene(root,1000,800);
scene.setFill(Color.BLACK);
scene.getStylesheets().add(getClass().getResource("paneBorderTest.css").toExternalForm());
mainPane.setId("mainPane");
mainPane.setPrefHeight(200);
mainPane.setPrefWidth(200);
mainPane.setLayoutX(400);
mainPane.setLayoutY(400);
Label label=new Label("Test");
label.setId("mainLabel");
label.setLayoutX(5);
label.setLayoutY(5);
label.setPrefHeight(100);
label.setPrefWidth(160);
mainPane.getChildren().add(label);
root.getChildren().add(mainPane);
primaryStage.setScene(scene);
primaryStage.show();
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(KeyEvent ke) {
String keyPressed=ke.getText() ;
logger.info("Key typed: "+keyPressed);
if("s".equals(keyPressed)){
mainPane.setStyle("-fx-border-width:2px 2px 0px 2px;");
}
else if("a".equals(keyPressed)){
mainPane.setStyle("-fx-border-width:2px 2px 2px 2px;");
}
}
});
}
And css code:
#mainPane
{
-fx-background-color: red;
-fx-border-color:white;
-fx-border-width:3px 3px 3px 3px;
}
#mainLabel{
-fx-text-fill:#FFFFFF;
-fx-font-family:Arial;
-fx-font-size:12px;
}
Example code:
@Override
public void start(Stage primaryStage) throws FocucsException{
Group root=new Group();
Scene scene = new Scene(root,1000,800);
scene.setFill(Color.BLACK);
scene.getStylesheets().add(getClass().getResource("paneBorderTest.css").toExternalForm());
mainPane.setId("mainPane");
mainPane.setPrefHeight(200);
mainPane.setPrefWidth(200);
mainPane.setLayoutX(400);
mainPane.setLayoutY(400);
Label label=new Label("Test");
label.setId("mainLabel");
label.setLayoutX(5);
label.setLayoutY(5);
label.setPrefHeight(100);
label.setPrefWidth(160);
mainPane.getChildren().add(label);
root.getChildren().add(mainPane);
primaryStage.setScene(scene);
primaryStage.show();
scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(KeyEvent ke) {
String keyPressed=ke.getText() ;
logger.info("Key typed: "+keyPressed);
if("s".equals(keyPressed)){
mainPane.setStyle("-fx-border-width:2px 2px 0px 2px;");
}
else if("a".equals(keyPressed)){
mainPane.setStyle("-fx-border-width:2px 2px 2px 2px;");
}
}
});
}
And css code:
#mainPane
{
-fx-background-color: red;
-fx-border-color:white;
-fx-border-width:3px 3px 3px 3px;
}
#mainLabel{
-fx-text-fill:#FFFFFF;
-fx-font-family:Arial;
-fx-font-size:12px;
}