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

Removal of hovered style class, does not update styling

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • fx2.0
    • javafx
    • None
    • build 08

      I have a label with a styleclass of "title". In some cases, not always, the label is clickable, and in that case I add the style class "clickable-title". In my stylesheet I have this

      .clickable-title:hover {
         -fx-text-fill: red;
      }

      This means, that whenever the label is clickable and it is assigned the styleclass "clickable-title" it will change its color to red if the mouse is over it. When the mouse moves away from it, the red color is removed.

      This all works fine, but there is a catch. Sometimes in my app, the label should no longer be clickable, at which point I remove the "clickable-title" style class. However, if the user's mouse is on top of the label at the time when I remove the "clickable-title" style class, the label is red in accordance with the CSS - and it stays red after I remove "clickable-title". I would expect that removing the "clickable-title" style class would cause a restyling where the original color is reapplied.

      (As a work-around, I have tried removing and adding some of the other styles, but I cannot seem to get the label to reapply its original styling.)

            dgrieve David Grieve
            risaksen Randahl Isaksen
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: