I am trying to add JList component to panel but the list look weird (cannot move it or it doesnt have a white back ground etc.) unless I use the Group Layout option in my panel. For example, I try to use GridBagLayout but I am unable to resize it as I want once I insert it..Is it possible to be able to use it “normally” with other layout options ? Thanks
Share
Java docs: “JList doesn’t implement scrolling directly. To create a list that scrolls, make it the viewport view of a JScrollPane.” You could resize your JList by resizing the scrollPane. Codes are in the Docs.
You could use JList.setVisibleRowCount() to adjust the number of the rows to be shown.
To manage dynamic contents, use ListModel
The layout may not be the essential problem.
Don’t have enough information for further answers. You could scan the Java docs and see if it helps.