Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8128953

Setting empty string in Label.setText() hides future text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • fx2.0.2
    • fx2.0
    • javafx
    • None
    • 2.0 build 40

      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.

            leifs Leif Samuelsson (Inactive)
            tbutterjfx Thomas Butter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: