简体   繁体   English

我可以在BorderLayout中强制自动换行吗

[英]Can I force automatic wrapping in BorderLayout

我想知道是否可以强制BorderLayout中的组件像在FlowLayout中那样进行包装。

BorderLayout, in principle, have only 5 positions: North, South, East, West and Center. 原则上,BorderLayout仅具有5个位置:北,南,东,西和居中。 If you want to micro-manage one of those positions, it is best that you put a JPanel there, and tweak its layout (eg, set it to FlowLayout). 如果要微管理这些位置之一,最好将JPanel放在那里,并调整其布局(例如,将其设置为FlowLayout)。

When using a FlowLayout the components will wrap automatically. 使用FlowLayout时,组件将自动包装。 The problem is that the height of the panel does not increase automaically, so you may never see the wrapped components. 问题在于面板的高度不会自动增加,因此您可能永远看不到包裹的组件。 The Wrap Layout tries to address this issue. Wrap Layout试图解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM