简体   繁体   English

用Java渲染这个设计有什么好的布局?

[英]What is a good layout to render this design in Java?

I'm new to Java. 我是Java的新手。 I'm making a multiplayer Tic-Tac-Toe game as a test. 我正在制作一款多人Tic-Tac-Toe游戏作为测试。 For the main menu, I'd love a layout that looked like this: 对于主菜单,我喜欢这样的布局: 理想的布局

The problem is, I have no idea how to make that. 问题是,我不知道如何做到这一点。 I have a JFrame with all the content ready (the buttons and such), but everything appears completely out of location. 我有一个准备好所有内容的JFrame (按钮等),但是所有内容都显示在完全不合适的位置。 I've tried BoxLayout , GridLayout , FlowLayout , and a few others, with no results. 我已经尝试过BoxLayoutGridLayoutFlowLayout和其他几个,没有结果。 I've had a headache over this all day, and any help would be appreciated. 我整天都很头疼,任何帮助都会受到赞赏。

So, if you have any recommended layouts, or any tips to get this working, that'd be great :) 所以,如果你有任何推荐的布局,或任何提示这个工作的提示,这将是伟大的:)

I would use a nested layout that looked something like this: 我会使用嵌套的布局,看起来像这样:

http://i.imgur.com/agGqAcW.png

GridBagLayout is useful for a more flexible layout, and BoxLayout for lining up a bunch of stuff. GridBagLayout对于更灵活的布局很有用, BoxLayout用于排列一堆东西。

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

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