make JList scrollable, but scroll bars are invisible (because it's never intended to be controlled via mouse)

This commit is contained in:
mykola2312 2024-04-08 14:37:48 +03:00
parent 0327a93cb3
commit 2594ff0eed

View file

@ -35,13 +35,19 @@ public class MainFrame {
categoryList = new JList<String>(items); categoryList = new JList<String>(items);
categoryList.setFont(font); categoryList.setFont(font);
categoryPanel.add(categoryList, BorderLayout.CENTER);
final JScrollPane categoryListScroll = new JScrollPane(categoryList);
categoryListScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
categoryPanel.add(categoryListScroll, BorderLayout.CENTER);
statusPanel.add(new JButton("status")); statusPanel.add(new JButton("status"));
channelList = new JList<String>(items); channelList = new JList<String>(items);
channelList.setFont(font); channelList.setFont(font);
channelPanel.add(channelList, BorderLayout.CENTER);
final JScrollPane channelListScroll = new JScrollPane(channelList);
channelListScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
channelPanel.add(channelListScroll, BorderLayout.CENTER);
if (fullscreen) { if (fullscreen) {
frame.setUndecorated(true); frame.setUndecorated(true);