2

有没有办法通过以下方式设置 JList 的样式:

  1. 将边框设置为自定义颜色,甚至将其完全删除
  2. 在 JList 边缘和显示的内容之间设置自定义边距
  3. 设置文本行之间的自定义边距

随意张贴我可以在 JList 上尝试的任何想法,即使您可能知道我没有在上面列出的那些想法。

4

1 回答 1

4

"Styling" is the domain of the UI delegate and cell renderer.

In every day working, the cell renderer is, by far, the simpler choice. This will allow you to modify the look of the rows and format the content as you see fit.

Take a look at How to use Lists, in particular, Writing a custom cell renderer for examples

If you don't mind a little more more work, you can also take a look at The Synth Look and Feel which is a type of skinning API ontop of the look and feel API

于 2013-08-02T01:01:02.697 回答