-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
in javascript any object is a hash table, to set or get style properties I can
if (node.style.color === "blue")
node.style.color = "red";
else
node.style.color = "blue";
Try doing the same using JFX API;
The same, incomlete
String key = "-fx-fill:";
String style = text.getStyle();
int index = style.indexOf(key);//assume is always there;
int endIndex = style.indexOf(";", index);//assume is always there
String value = style.substring(index + key.length(), endIndex).trim();
String newStyle = style.substring(0, index) + style.substring(endIndex + 1);
if (value.equals("red")) {
newStyle += "-fx-fill: blue;";
} else {
newStyle += "-fx-fill: red;";
}
text.setStyle(newStyle);
if (node.style.color === "blue")
node.style.color = "red";
else
node.style.color = "blue";
Try doing the same using JFX API;
The same, incomlete
String key = "-fx-fill:";
String style = text.getStyle();
int index = style.indexOf(key);//assume is always there;
int endIndex = style.indexOf(";", index);//assume is always there
String value = style.substring(index + key.length(), endIndex).trim();
String newStyle = style.substring(0, index) + style.substring(endIndex + 1);
if (value.equals("red")) {
newStyle += "-fx-fill: blue;";
} else {
newStyle += "-fx-fill: red;";
}
text.setStyle(newStyle);
- relates to
-
JDK-8091202 CSS Style Object Model in Java
-
- Open
-