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 setSelected(boolean isSelected) { _button.setEnabled(!isSelected); if (!isSelected) _courseList.clearSelection(); }