BorderLayout的 - 控制高度,但宽度不 [英] BorderLayout - Control height but not width

查看:210
本文介绍了BorderLayout的 - 控制高度,但宽度不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是比较新到Java UI和AP将preciate你的帮助,一个简单的问题,我有。

I am relatively new to Java UI and would appreciate your help with a simple problem that I have.

我有一个的JP​​anel 类型的BorderLayout 。在中心部分包含一个组合框。

I have a JPanel of type BorderLayout. The CENTER part contains a combo box.

由于外框架的大小时,面板尺寸缩小(这是需要)和组合框的宽度将更改(这个太需要)。不过,组合框的高度也在不断变化与面板调整大小。这是不希望的。

As the outer frame is resized, the panel resizes (this is desired) and the width of the combo box changes (this is desired too). However, the height of the combobox is also changing as the panel is resized. This is not desired.

如何确保我的组合框的宽度扩大而不是在高度?

How can I ensure that my combo box expands in width but not in height?

我也有 LINE_START 按钮。我想这个按钮完全不舒展。

I also have a button in LINE_START. I would like this button not to stretch at all.

推荐答案

把组合。到面板,然后将其加入到主的中心 BorderLayout的。做同样的按钮。

Put the combo. into the NORTH of a panel that is then added to the CENTER of the main BorderLayout. Do the same with the button.

这篇关于BorderLayout的 - 控制高度,但宽度不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆