title: How do I style a cell in the date picker that is not in the current month
body: <p>I'm currently working on a registration form for my JavaFX application. The thing is, I want to make cells in the date picker grey out when that cell isn't on the page's month. Let's look at my current date picker.</p>
  <p>My date picker:</p>
  <p><a href="https://i.stack.imgur.com/Q4NXs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q4NXs.png" alt="enter image description here" /></a></p>
  <p>As you can see I want the dates 27th, 28th, ..., 30th and 1st, 2nd, 3rd, ... on the next month to be grey out. How can I do it?</p>
  <p>I've looked at all of the possible ways to make it happen, I think it might be on &quot;dayCellFactory&quot; I don't know...</p>
  <pre class="lang-java prettyprint-override"><code>final Callback&lt;DatePicker, DateCell&gt; dayCellFactory = new Callback&lt;&gt;() {
      public DateCell call(DatePicker datePicker) {
          return new DateCell() {
              @Override
              public void updateItem(LocalDate item, boolean empty) {
                  super.updateItem(item, empty);
                  this.getStyleClass().add(&quot;form-date-picker-cell&quot;);
              }
          };
      }
  };
  datePicker.setDayCellFactory(dayCellFactory);
  </code></pre>
  <p>My approach was to query a current month from the date picker and check if that cell is on that month, but I don't know how to get a month from the date picker.</p>