문제

Depending on what they choose in the JComboBox I want the JList to show different strings, not sure how to repopulate a JList though. When searching through the API, still found nothing.

Any idea on how you might code this?

Im using NetBeans by the way for reference.

도움이 되었습니까?

해결책

not sure how to repopulate a JList though

DefaultListModel model = new DefaultListModel(...);
// add items to the model
list.setModel( model );

Or you could use the DefaultComboBoxModel which would allow you to create with model with a Vector or Array.

다른 팁

The setListData() method allows you to reset the contents of the list.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top