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

DateCell text color are not updated correctly when DateCell with disable = true is reused

    Details

    • Subcomponent:
    • Introduced In Build:
      b15
    • Introduced In Version:
      10
    • CPU:
      x86_64
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "10" 2018-03-20
      Java(TM) SE Runtime Environment 18.3 (build 10+46)
      Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode

      ADDITIONAL OS VERSION INFORMATION :
      maOS High Sierra 10.13.4

      A DESCRIPTION OF THE PROBLEM :
      DateCell text color are not updated correctly when DateCell with disable = true is reused.

      This problem has occurred in JDK 10.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Start the test application
      2) Display the calendar popup
      3) Last month click
      4) Next month click
      5) Next month click

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The text color of DateCell is displayed correctly
      ACTUAL -
      Some DateCell text colors are grayed out

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.time.LocalDate;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.DateCell;
      import javafx.scene.control.DatePicker;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class DateCellDisableTest extends Application{

      @Override
      public void start(Stage primaryStage) throws Exception {

      DatePicker datePicker = new DatePicker();

      datePicker.setDayCellFactory((cell)->{
      return new DateCell() {
      @Override
      public void updateItem(final LocalDate item, final boolean empty) {
      super.updateItem(item, empty);

      if (item.isBefore(LocalDate.now())) {
      this.setDisable(true);
      }
      }
      };
      });


      BorderPane root = new BorderPane(datePicker);

      Scene scene = new Scene(root, 400, 400);
      primaryStage.setScene(scene);
      primaryStage.show();
      }

      public static void main(String[] args) {
      Application.launch(args);
      }

      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pkbalakr Prem Balakrishnan (Inactive)
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: