CSS id selector with embedded dot
Jens Auer
Jens.Auer at h-d-gmbh.de
Wed May 10 13:23:53 UTC 2017
Hi,
I am working on a project which enforces unique FX Id by using a naming convention mirroring the hierarchical structure of the controls in the name, delimited by dots. So for example, we have a button "myPane.button1". I am not able to select this button in a css file. Here is an example program and the css file:
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class CssTest extends Application {
public static void main(final String[] args) {
Application.launch(args);
}
@Override
public void start(final Stage stage) {
VBox vbox = new VBox();
Button b1 = new Button();
b1.setId("the.button");
b1.setText("BUTTON1");
Button b2 = new Button();
b2.setId("thebutton");
b2.setText("BUTTON2");
vbox.getChildren().addAll(b1, b2);
vbox.getStylesheets().add("stylesheet.css");
final Scene scene = new Scene(vbox);
stage.setScene(scene);
stage.show();
}
}
The css file is
#the\.button {
-fx-graphic: url("Keyboard.png");
}
#thebutton {
-fx-graphic: url("Keyboard.png");
}
As far as I understand the CSS definition the names are valid ids and escaping should work here. Is this a limitation in the JavaFX CSS parser?
Best wishes,
Jens
Jens Auer
(Softwareentwicklung)
___________________________________________________________
Unternehmensberatung H & D GmbH
Niederlassung Weißenthurm
Werftstr. 5 - 56575 Weißenthurm
Tel.: 02637/94238 -110
Fax: 02637/94238 -149
jens.auer at h-d-gmbh.de
http://www.h-d-gmbh.de
http://www.h-d-gmbh.de/impressum.html
___________________________________________________________
More information about the openjfx-dev
mailing list