简体   繁体   中英

How to position two JPanels diagonal from each other in Java?

I was wondering what layout or hack could be used to position these two JPanels so that it would end up looking like this?

在此输入图像描述

It seems like most layouts depend on the position of other components and either positions them vertically or horizontally in respect to the other components.

Note: Panel 2 is smaller than panel 1.

I would use the BoxLayout layout manager in combination with Box . But there are several other options. This is just my personal preference.

For more information, please see How to Use BoxLayout .

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