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

Text in a disabled TextArea is lighter than text in a disabled TextField

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u72, 9
    • javafx
    • x86
    • os_x

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.8.0_72-ea"
      Java(TM) SE Runtime Environment (build 1.8.0_72-ea-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 25.72-b05, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.9.5

      $ uname -a
      Darwin **** 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      2015 Macbook Pro Retina 15"

      A DESCRIPTION OF THE PROBLEM :
      Text in a TextArea shows lighter than text in a TextField because the CSS based opacity modifier for disabled fields is applied twice for the TextArea (once for the TextArea itself, then again for the ScrollPane implicitly placed inside the TextArea by the TextArea skin).

      For more information, workarounds, sample programs and screenshots see:
        http://stackoverflow.com/questions/35712028/why-does-disabled-javafx-textarea-has-a-different-color-than-textfield/35712919#35712919

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute the attached test case code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Text in disabled TextFields and TextAreas should have the same color.
      ACTUAL -
      Text in disabled TextFields and TextAreas should have different colors.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.*;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class DisabilityAssistance extends Application {
          @Override
          public void start(Stage stage) throws Exception{
              TextArea area = new TextArea("Text Area");
              area.setDisable(true);
              TextField field = new TextField("Text Field");
              field.setDisable(true);

              Scene scene = new Scene(new VBox(10, area, field));
              stage.setScene(scene);
              stage.show();

      // scene.getStylesheets().add(getClass().getResource(
      // "disability.css"
      // ).toURI().toURL().toExternalForm());
          }

          public static void main(String[] args) {
              launch(args);
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Explicitly set the opacity of the scroll pane inside the TextArea to an opacity of 1 when it is disabled (rather than letting it change to the default disabled value of 0.4).

      .text-input > .scroll-pane:disabled {
          -fx-opacity: 1;
      }

            jgiles Jonathan Giles
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: