日期:2014-05-20  浏览次数:20688 次

送分啦!一个简单的问题!
有一个JCombobox,一个JTable对象com和tab,想要实现功能如下:
当单击com选择里面的一个选项,然后在tab表里面的一个表格显示出来.用什么事件监听器?

------解决方案--------------------
3楼的和5楼的别误人子弟。
final Label label = new Label(container, SWT.NONE);
label.setText("Label");

combo = new Combo(container, SWT.NONE);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent e) {
label.setText(combo.getText());
}
});
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
combo.add("中国");
combo.add("法国");
combo.add("德国");
------解决方案--------------------
public void jComboBox1_actionPerformed(ActionEvent e) {
//这里你做相应的tab的操作

}在这个里面写你的变化的事件..
我在jbuild里试了下 你要显示的东西要在这个里面调用,在相应的tab中就会显示你要的.
------解决方案--------------------
Source Event Event Listener
--------------------------------------------------------------------------
AbstractButton ActionEvent ActionListener
(JButton,JtoggleButton, ChangeEvent ChangeListener
JCheckBox,JRadioButton ItemEvent ItemListener
-------------------------------------------------------------------
JTextField ActionEvent ActionListener
JpasswordField CaretEvent CaretListener
DocumentEvent DocumentListener
UndoableEvent UndoableListener
-------------------------------------------------------------------
JTextArea CaretEvent CaretListener
DocumentEvent DocumentListener
UndoableEvent UndoableListener
-------------------------------------------------------------------
JTextPane CaretEvent CaretListener
JEditorPane DocumentEvent DocumentListener
UndoableEvent UndoableListener
HyperlinkEvent HyperlinkListener
-------------------------------------------------------------------
JComboBox ActionEvent ActionListener
ItemEvent ItemListener
-------------------------------------------------------------------
JList ListSelectionEvent ListSelectionListener
ListDataEvent ListDataListener
-------------------------------------------------------------------
JFileChooser ActionEvent ActionListener
-------------------------------------------------------------------
JMenuItem ActionEvent ActionListener