So I'm not sure if there is a fix to this but I have a JList which is defined as listArea and Vector as listVector and I added a scrollPane to the main panel. Whenever I set a width to the list area, the scrollbar disappears but when I remove the width, it brings up the scrollbar but the size of the listArea is too bigCode:String width = "1514153253245435432563245342"; listArea.setPrototypeCellValue(width); listArea.setFont(new Font("Consolas",Font.PLAIN,10)); listArea.setVisibleRowCount(15); listArea.addListSelectionListener(new ListListener()); JScrollPane listScrollPane = new JScrollPane(listArea); listArea.setListData(listVector); searchCenterPanel.add(listScrollPane);
help please and thank you
Try setting the size on the JScrollPane object instead of the Jlist.
HTH
Try creating the scroll pane with the vertical scroll bar set to always visible. ie new JScrollPane(myList, JScrollPane.VERTICAL...option, JScrollPane.HORIZONTAL...option)
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks