title: JavaFX: use a TableView as a calendar and fill it with events
body: <p>I'm trying to make a calendar like application with fills a week schedule with lectures.</p>
  
  <p>This is the code for the Lecture class:</p>
  
  <pre><code>public class Lecture {
  
      private final String course;
  
      private final int day;
  
      private final int duration;
  
      private final int studentId;
  
      private final int teacherId;
  
      private final int locationId;
  
      private final int firstBlock;
  
      public String getCourse() {
          return course;
      }
  
      public int getDay() {
          return day;
      }
  
      public int getDuration() {
          return duration;
      }
  
      public int getStudentId() {
          return studentId;
      }
  
      public int getTeacherId() {
          return teacherId;
      }
  
      public int getLocationId() {
          return locationId;
      }
  
      public int getFirstBlock() {
          return firstBlock;
      }
  
      public Lecture(String course, int day, int duration, int studentId, int teacherId, int locationId, int firstBlock){
          this.course = course;
          this.day = day;
          this.duration = duration;
          this.studentId = studentId;
          this.teacherId = teacherId;
          this.locationId = locationId;
          this.firstBlock = firstBlock;
      }
  
      public String toString(){
          if(course == null){
              return "(empty)";
          } else {
              return course;
          }
      }
  }
  </code></pre>
  
  <p>Depending on the day and firstblock values the lecture gets placed in my TableView. Right now I made a custom row class which handles all this and fills the rows in my TableView. The result looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/TgI9S.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TgI9S.jpg" alt="enter image description here"></a></p>
  
  <p>Is it possible to use a CellFactory to place the lectures on the right place? (maybe create labels with the name of the lecture, and empty labels if there isn't a lecture).</p>
  
  <p>I also want to add a contextmenu that pops up when you right click a course or an empty cell to have to possibility to add or remove a course, which I need the cellfactory for I think. 
  Note that it has to be possible to have more than one lecture in a cell.</p>
  
  <p>Edit: Would it be possible to use different lists to fill different columns? for example a list that has all lectures for a monday?</p>