现在faf 为JTextArea ,zdy为JComboBox,run为测试JButton
JButton run = new JButton("测试")//JButton
faf = new JComboBox<Object>();//JTextArea
faf.setModel(new DefaultComboBoxModel<Object>(new String[] {}));
zdy = new JTextArea();//JComboBox
JTextArea 内容输出至 JComboBox
run.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//多选框
int dj=faf.getSelectedIndex()+1;
String nr=(String)faf.getSelectedItem();
System.out.println("你选中的是第"+dj+"项"+",内容是:"+nr);
//多文本
System.out.println(zdy.getText());//可以输出文本框
}
});