简体   繁体   English

将JPanel与另一个JPanel中心绑定

[英]Bind JPanel side with another JPanel Center

Hi I am building a UI for a project and I have a JPanel which I want to divide into two equal parts. 嗨,我正在为一个项目构建一个UI,我有一个JPanel,我想分成两个相等的部分。 I am trying to find a way to add two small JPanel inside the big one but I don't know how to bind one side of a JPanel with the center of a bigger one. 我试图找到一种方法在大的内部添加两个小的JPanel,但我不知道如何将JPanel的一侧与更大的一侧绑定。 Any idea ? 任何想法 ?

I am trying to find a way to add two small JPanel inside the big one 我试图找到一种方法在大的内部添加两个小JPanel

Use a GridLayout on the big panel. 在大面板上使用GridLayout。 The layout manager will automatically make both panels the same size. 布局管理器将自动使两个面板的大小相同。 Read the section from the Swing tutorial on How to Use GridLayout . 阅读Swing教程中有关如何使用GridLayout的部分

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

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