我想減小組件之間的大小,在格式組(圖像的左側)。這個怎麼做?如何減少3個擺動複選框之間的空間?
JPanel formattingGroup = createGroupWithName("Formatting");
formattingGroup.setMinimumSize(new Dimension(250, 20));
formattingGroup.setLayout(new GridLayout(5, 0));
add(formattingGroup);
final JCheckBox showSurface = new JCheckBox("Show surface");
showSurface.setSelected(true);
formattingGroup.add(showSurface);
final JCheckBox showTerrain = new JCheckBox("Show terrain");
showTerrain.setSelected(true);
formattingGroup.add(showTerrain);
final JCheckBox showVehicleStatus = new JCheckBox("Show vehicle status");
showVehicleStatus.setSelected(true);
formattingGroup.add(showVehicleStatus);
JPanel pnl = createGroupWithName("Depth Stretch");
formattingGroup.add(pnl);
JSlider slider = new JSlider(0, 10);
pnl.add(slider);
最誠實的問題:Isnt是否只能在[Nimbus外觀](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/custom.html)中使用組件的大小調整選項? '「Nimbus是目前唯一支持尺寸變體的Sun外觀」' – hamena314 2016-01-25 13:00:43
它是唯一支持尺寸變體的_Sun_(現在是Oracle)L&F; 'com.apple.laf.AquaLookAndFeel'也可以用於[示例](http://stackoverflow.com/a/17392522/230513)。 – trashgod 2016-01-25 14:52:45