GridLayout具有不同的高度列 [英] GridLayout with different height column

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

问题描述



如何制作如下所示的GUI?我尝试了GridLayout但是面板A和B的大小总是相等的。我如何制作不等于30px和200px的东西......另外,我想用手工编码的方法。没有拖放。

Hi,
How do I make a GUI that look like this? I tried GridLayout but the size of Panel A and B is always equal. How do i make something NOT equal like 30px vs 200px ......Also, I want to hand coded method. No drag and drop.

------------------------------------------
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-            JPanel A(1000px x 30px)     -
-                                        -
------------------------------------------
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-            JPanel B(1000px x 100px)    -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
-                                        -
------------------------------------------

推荐答案

尝试使用GridBagLayout而不是GridLayout。 请参阅此处
Try GridBagLayout instead GridLayout. See here


也适合您:< br $> b $ b

http://docs.oracle .com / javase / tutorial / uiswing / layout / visual.html [ ^ ]



a简单的Borderlayout可以解决问题。



您还可以在Grldlayout中添加各种大小的项目(如果需要,可以继续使用)。恕我直言网格将呈现。
Also for you:

http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html[^]

a simple Borderlayout will do the trick.

You can also add various sized items in the Grldlayout (if needed to stay with that). IMHO the grid will render that.


这篇关于GridLayout具有不同的高度列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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