Wednesday, March 12, 2008

Get that stupid JList to stop wrapping

Here's the deal. I've got a list of "recipes", each is a node in a javax.swing.JList. Each recipe is a panel of many things: image, title, etc. The JList didn't do too much until I figured out this:

recipesList.setVisibleRowCount(1);

A-ha, now the list no longer automatically wraps when the surrounding window (which is a JScrollPane, of course.) Maybe I'm just hung over, but this wasn't obvious to me.

No comments: