简体   繁体   中英

Java: Transposing a SpringLayout

I've got a SpringLayout that I need to transpose.

Basically, when you create a SpringLayout it fills out the panel by columns, so that if you have

JPanel temp = new JPanel()
retCase2.add(label = new JLabel("A"));
retCase2.add(label = new JLabel("B"));
retCase2.add(label = new JLabel("C"));
retCase2.add(label = new JLabel("D"));

Utils.makeCompactGrid(retCase2,
2, 2, //rows, cols
1, 1,        //initX, initY
10, 10);  

The result is a table that looks like this:

A B
C D

However, I want

A C
B D

Does anyone know how to do this?

只需切换“b”和“c”的顺序

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