Java – add JPanel to JList?

Use the NetBeans GUI editor to create a bowling plan for the school Can I add JPanel to JList? If so?

Solution

It's not actually possible (meaning it won't be what you expect) - what you really want is a list layoutmanager, which will arrange components in vertical or horizontal lists Therefore, instead of using JList, use JPanel with a layout manager with a similar list

Try these:

>BoxLayout will put all jpanels in one column / row > GridLayout will put all jpanels in one column / row and make them the same size

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>