如果要让jTextField1的值随jComboBox1的选择变化,则在Event事件中选择“itemStateChanged”。JBuilder自动生成public void jComboBox1_itemStateChanged(ItemEvent e) {}后在该方法内添加代码格式如下:
public void jComboBox1_itemStateChanged(ItemEvent e) {
this.jTextField1.setText("")
this.jTextField1.setText(this.jComboBox1.getSelectedItem().toString())
}
//以下是JBuilder自动生成的事件监听器
class Frame1_jComboBox1_itemAdapter implements ItemListener {
private Frame1 adaptee
Frame1_jComboBox1_itemAdapter(Frame1 adaptee) {
this.adaptee = adaptee
}
public void itemStateChanged(ItemEvent e) {
adaptee.jComboBox1_itemStateChanged(e)
}
}
用initComponent: function() 来加事件给你看一段我们项目中代码吧!
Ext.extend(Ext.tree.TreePanel, {
title: '机构列表',
header:false,
rootVisible:false,
collapseFirst:false,
autoScroll: true,
bodyBorder:false,
// height: document.documentElement.clientHeight-111,
initComponent: function() {
this.root = new Ext.tree.AsyncTreeNode({
text:'员工管理',
id:'root',
expanded:true
})
this.loader = new Ext.tree.TreeLoader({dataUrl:NGBOSS.APP_URL+'/employees/treeList?organizationStatus=1'})
com.zjcy.ngboss.sys.employee.grid.TreePanelUi.superclass.initComponent.call(this)
}
})
Private Sub ComboBox_Click()Select Case ComboBox.Text
Case "List1"
'进行………… *** 作
Case "List2"
'进行………… *** 作
Case "List3"
'进行………… *** 作
End Select
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)