我相信你的老师写道:
JList list = new JList<>(listModel); /* ... */ list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //note how the methods name is supposed to end with Mode, not Model