public PlanViewPanel(
      PlannerUI plannerUI, StudentPlan plan, boolean showOptional, SchoolAdapter schoolAdapter) {
    _plannerUI = plannerUI;
    _plan = plan;
    _schoolAdapter = schoolAdapter;
    _showOptional = showOptional;

    _semesterPanels = new PlanViewSemesterPanel[_plan.years()][_plan.semesters(0)];
    for (int i = 0; i < _semesterPanels.length; i++)
      for (int j = 0; j < _semesterPanels[i].length; j++)
        _semesterPanels[i][j] = new PlanViewSemesterPanel(_plan, this, i, j);
    _semesterPanels[_selectedYear][_selectedSemester].setSelected(true);

    // monitorStudentPlan(_plan);

    draw();
  }
 private JButton button() {
   JButton result =
       new JButton(((StudentSemesterPlan) _plan.getSemester(_year, _semester)).getTitle());
   result.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           _planViewPanel.setSelectedSemester(_year, _semester);
         }
       });
   return result;
 }
 private JList courseList() {
   JList result = new JList((ListModel) _plan.getSemester(_year, _semester));
   result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
   result.setCellRenderer(_planViewCellRenderer);
   result.addListSelectionListener(
       new ListSelectionListener() {
         public void valueChanged(ListSelectionEvent e) {
           if (_courseList.getSelectedIndex() > -1) {
             _planViewPanel.courseSelected(
                 (Course) _courseList.getModel().getElementAt(_courseList.getSelectedIndex()),
                 _year,
                 _semester);
             //				_planViewPanel.setSelectedSemester(_year, _semester);
           }
         }
       });
   return result;
 }
 public void draw() {
   removeAll();
   int numSemesters;
   if (_showOptional) numSemesters = _schoolAdapter.getSemesters().length;
   else {
     numSemesters = 0;
     for (int i = 0; i < _schoolAdapter.getSemesters().length; i++)
       if (_schoolAdapter.getRequiredSemesters()[i]) numSemesters++;
   }
   setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
   for (int year = 0; year < _plan.years(); year++) {
     final JPanel yearPanel = new JPanel();
     yearPanel.setLayout(new GridLayout(1, numSemesters));
     // yearPanel.setPreferredSize(new Dimension(0, 200));
     for (int semester = 0; semester < numSemesters; semester++) {
       _semesterPanels[year][semester] = new PlanViewSemesterPanel(_plan, this, year, semester);
       yearPanel.add(_semesterPanels[year][semester]);
     }
     add(yearPanel);
   }
   _semesterPanels[_selectedYear][_selectedSemester].setSelected(true);
 }