简体   繁体   English

使其他JPanel中的JPanel左对齐

[英]Getting JPanels within other JPanels to left align

I have an options JPanel which consists of 3 jpanels (which hold a JLabel and JRadio buttons). 我有一个选项JPanel,它由3个jpanel(包含一个JLabel和JRadio按钮)组成。 The 3 sub JPanels have the default layout. 3个子JPanel具有默认布局。

The options panel has a BoxLayout on the Y Axis. 选项面板在Y轴上具有BoxLayout。

I then have the main gui which is a JFrame with a topPanel (using BorderLayout) which adds the options panel to itself using BorderLayout WEST. 然后,我有一个主要的GUI,它是一个带有topPanel的JFrame(使用BorderLayout),它使用BorderLayout WEST将选项面板添加到自身。

My problem is that the options panel is stretched and the labels are center aligned. 我的问题是选项面板被拉伸并且标签居中对齐。

Here is a image of what I mean. 这是我的意思的图片。 I have what's on the left but want whats on the right. 我有左边的东西,但想要右边的东西。 在此处输入图片说明

Have you tried MigLayout ? 您是否尝试过MigLayout It is by far the most flexible and powerful Layout manager for swing/swt. 它是迄今为止针对swing / swt的最灵活,功能最强大的布局管理器。

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

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