swing
JList
수색…
JList에서 선택한 요소 수정
주어진 JList
와 같은
JList myList = new JList(items);
리스트 내의 선택된 항목은, JList
의 ListSelectionModel
를 사용해 변경할 수 있습니다.
ListSelectionModel sm = myList.getSelectionModel();
sm.clearSelection(); // clears the selection
sm.setSelectionInterval(index, index); // Sets a selection interval
// (single element, in this case)
또는 JList
는 선택된 인덱스를 직접 조작 할 수있는 편리한 메소드를 제공합니다.
myList.setSelectionIndex(index); // sets one selected index
// could be used to define the Default Selection
myList.setSelectedIndices(arrayOfIndexes); // sets all indexes contained in
// the array as selected
Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow