3
ここでは、私のコードの一部です:あなたが画像で見ることができるようボックスレイアウトの幅
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
JPanel a = new JPanel();
a.setAlignmentX(Component.CENTER_ALIGNMENT);
a.setPreferredSize(new Dimension(100, 100));
a.setBorder(BorderFactory.createTitledBorder("aa"));
JPanel b = new JPanel();
b.setAlignmentX(Component.CENTER_ALIGNMENT);
b.setPreferredSize(new Dimension(50, 50));
b.setBorder(BorderFactory.createTitledBorder("bb"));
pane.add(a);
pane.add(b);
問題は、第二パネルの幅である:
、私はそれを解決することができますか?
フローレイアウトで、それは私がしたいように見えるので:
多くの点でうまくいきます – hudi