简体   繁体   中英

What layout manager will do this?

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                             | |
|  ------------------------------------------------ |
|___________________________________________________|

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).

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

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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