什么布局经理会这样做? [英] What layout manager will do this?

查看:165
本文介绍了什么布局经理会这样做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OY,没有足够的代表发布图片...

OY, not enough rep points to post an image...

____________________________________________________
|joes pizza                                         |
|          pizza type  toppings         ----------- |
|                                       |         | |
|          cheese       mushrooms       | 15.00   | |
|          veggie       extra cheese    |         | |
|          pepperoni    bacon           |         | |
|                                       ----------  |
|  _______________________________________________  |
|  |  calculate total                             | |
|  ------------------------------------------------ |
|___________________________________________________|

我应该为课程构建这个,其中中间的选项是单选按钮和检查盒子,我的框架中的所有组件都在我的框架中。我剩下要做的就是actionListener,让它看起来像这样。我们正在学习布局管理器,并且已经获得了五个(FlowLayout,BorderLayout,GridLayout,BoxLayout,CardLayout和GridBagLayout)。

I'm supposed to build this for class, where the options in the middle are radio buttons and check boxes, and I have all the components in my panels in my frame. All I have left to do is actionListener and make it look like this. We are learning Layout Managers, and have been given five (FlowLayout, BorderLayout, GridLayout, BoxLayout, CardLayout, and GridBagLayout).

但我似乎无法让它们看起来像这样。他们要么全部以一条线或一些疯狂的交错代表结束,要么从边境到边界拥挤。有什么建议?如果我的设置妨碍了我,我在标签中有乔披萨,窗格中有披萨类型,窗格中有浇头,右边是textArea,最后是按钮。我不是在寻找答案或代码来实现它,只是想知道我应该使用什么工具。如果我无法弄清楚这些工具,我会在评论中提出另一个问题或提问。感谢您的任何建议。

I can't seem to make any of them look like this, though. They either all end up in a line or in some crazy staggered representation, or crowded in from border to border. Any suggestions? In case my setup is getting in the way, I have joe's pizza in a label, pizza type in a pane, toppings in a pane, the textArea on the right, and finally a button. I'm not looking for an answer or the code to make it happen, just want to know what tools I should be using. If I can't figure out the tools, I'll ask another question or ask in the comments. Thanks for any suggestions.

Tony

推荐答案

你可以筑巢 JPanels 具有不同的布局。这是一种方法。图片应该说明一切。

You can nest JPanels with different layouts. Here is one way to go about it. Picture should say it all.

这篇关于什么布局经理会这样做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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