用GridBagLayout布局。。constrants参数设置中weightx设为1
公司说不能用这种布局,维护麻烦
1 JPanel viewPanel = new Jpanel(); 2 viewPanel.setLayout(new BorderLayout()); 3 JLabel lable = new JLabel("区域代码设置:"); 4 JComboBox box = new JComboBox(); 5 //initialize items of box here... 6 viewPanel.add(label, BorderLayout.West); 7 viewPanel.add(box, BorderLayout.Center);