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

Changing the CSS style set doesn't work with all style elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • fx2.0
    • javafx
    • None
    • java.vendor=Sun Microsystems Inc.
      java.version=1.6.0_24
      java.vm.vendor=Sun Microsystems Inc.
      java.vm.version=19.1-b02
      os.name=Windows 7
      os.arch=x86
      os.version=6.1

      JavaFX 2.0 ea b18

      Some controls/nodes respect style sheet changing some not.

      I have a toggle button in my scene to set/remove css styles.

          cssToggle.addChangeListener(ToggleButton.SELECTED, new ChangeListener() {
            @Override
            public void handle(Bean bean, PropertyReference<?> property) {
              if ( cssToggle.isSelected() ) {
                scene.getStylesheets().add(style);
              } else {
                scene.getStylesheets().setAll("");
              }
            }
          });

      But I've some problems on resetting the style.

      TextBox:
      the input font is still the font from the previous styled font

      Rectangle:
      the background fill is from the previous styled -fx-fill

      ToggleButton:
      After removing the style sheet I've two focus borders

      This one
      .toggle-button:focused{
        -fx-border-color: deepskyblue ;
        -fx-border-insets: -4;
        -fx-border-width: 2;
      }
      and the standard focus border.


      I've added a compiled screenshot and the source.

        1. StyleSheetSwitchProblems.png
          36 kB
          Aljoscha Rittner

            dgrieve David Grieve
            arittnerjfx Aljoscha Rittner (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: