List of usage examples for javax.swing DefaultListSelectionModel clone
public Object clone() throws CloneNotSupportedException
From source file:Main.java
public Main() { setLayout(new BorderLayout()); list = new JList(label); JScrollPane pane = new JScrollPane(list); DefaultListSelectionModel m = new DefaultListSelectionModel(); m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); m.setLeadAnchorNotificationEnabled(false); list.setSelectionModel(m);/*from w w w . ja v a2s . c om*/ try { DefaultListSelectionModel mClone = (DefaultListSelectionModel) m.clone(); } catch (CloneNotSupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } add(pane, BorderLayout.NORTH); }