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);
問題是與第二面板的寬度,你可以在圖片看到:
怎樣才能解決這個問題?
因爲在流式佈局看起來我想:
thx很多工作 – hudi 2012-04-15 00:31:52