Search code examples
javalinejlistword-wrap

Force JList to NOT wrap at all?


Is there a possibility to force JLists to display all items on one line? setOrientationLayout() does not give you that option.


Solution

  • list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
    list.setVisibleRowCount(1);