In a subclass of Label setting the Text to "" in the constructor leads to a label not showing any text anymore after text changes.
Example
public class UserStatus extends Label implements UserListener {
[...]
UserStatus(int userid) {
labelPaddingProperty().set(new Insets(1, 1, 1, 3));
setStyle("-fx-text-fill: white;");
setText("");
setGraphic(circle);
[...]
public void setOnline(final boolean b) {
Platform.runLater(new Runnable() {
public void run() {
setText("blah");
[...]
Won't show text after the setText("blah"). Changing the first setText("") to setText(" ") (single space) fixes the problem.
Example
public class UserStatus extends Label implements UserListener {
[...]
UserStatus(int userid) {
labelPaddingProperty().set(new Insets(1, 1, 1, 3));
setStyle("-fx-text-fill: white;");
setText("");
setGraphic(circle);
[...]
public void setOnline(final boolean b) {
Platform.runLater(new Runnable() {
public void run() {
setText("blah");
[...]
Won't show text after the setText("blah"). Changing the first setText("") to setText(" ") (single space) fixes the problem.
- duplicates
-
JDK-8119095 Bound Label text not displayed when a graphic node is set.
- Closed