I have JList
code that I want to add to a scroll button on the side since the list is longer than the text box window.
that's the code:
final JList list = new JList();
list.setBounds(36, 23, 366, 241);
contentPane.add(list);
File folder = new File(FILETOSTART);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
System.out.println("File " + listOfFiles[i].getName());
list.setListData(listOfFiles);
} else if (listOfFiles[i].isDirectory()) {
System.out.println("Directory " + listOfFiles[i].getName());
}
}
}
in.close();
}
catch (Exception exception) {
exception.printStackTrace();
How can I add this scroll side button?