Java separate components with lines

邮差的信 提交于 2019-12-05 18:51:44
trashgod

JSeparator, shown here, is commonly used in this context. It works well with most layouts. Also, consider How to Use Borders.

Addendum: The JSeparator UI delegate for a given Look & Feel, often modeled on BasicSeparatorUI, is particularly simple. It's paint() implementation draws a one pixel line in the foreground color and an adjacent one pixel line in the background color. The lines are as wide (or high) as the component's bounds, depending on orientation. The layout manager determines the spacing, so you'll want to review A Visual Guide to Layout Managers.

kleopatra

JSeparator returns weird sizing hints, the most problematic bit for a max respecting LayoutManager like BoxLayout is its unbounded max, see also a recent discussion (which was about vertical separators, same for horizontal, though)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!