java swing怎样做一个列表这样的吧,表中一个项有两个Jlabel?如图这样:

2025-04-18 13:16:02
推荐回答(3个)
回答1:

GridLayout

仅供参考
import java.awt.*;
import java.applet.Applet;
public class ButtonGrid extends Applet {
public void init() {
setLayout(new GridLayout(3,2));
add(new Button("1"));
add(new Button("2"));
add(new Button("3"));
add(new Button("4"));
add(new Button("5"));
add(new Button("6"));
}
}

回答2:

肯定是要布局的,,比如使用T3BorderLayout,T4FlowLayout,具体可以看官方文档

回答3:

用GridLayout,5行两列