JList: Horizontal_WRAP fitted?

Hey,.. i wanna show pictures with names onit in a jList, i know it get's also in a JPanel but i'm now using a jList, doesn't matter..

My question is why does the jlist don't fit the images only in 2 horizontal 'cells' and then go one row down?

sry my english is bad and i don't know how to describe it better, but look on the picture, why does the jlist dont set the e.g. 3rd picture right next to the 2nd?

alt text

Upvotes: 0

Views: 1651

Answers (2)

Robert
Robert

Reputation: 2669

If you use HORIZONTAL_WRAP you can adjust the number of columns with setVisibleRowCount. If you want them automatically fitted to the width of the list, use 0 or something negative.

Upvotes: 0

trashgod
trashgod

Reputation: 205785

JList.HORIZONTAL_WRAP works correctly in the ListDialog JWS demo, as described in Initializing a List. I suspect a layout problem, but you might compare your code to the examples found there.

Upvotes: 1

Related Questions