Very funny, just one line of code make it fine.
String[] data = {"one", "two", "three", "four", /* AND A LOT MORE */}; JList dataList = new JList(data); JScrollPane scrollPane = new JScrollPane(dataList); /* And scroll to selected index */ dataList.ensureIndexIsVisible(dataList.getSelectedIndex());
No comments:
Post a Comment