JComboBox jcombox=new JComboBox(stkName);
JRadioButton today_radioButton=new JRadioButton("Today",true);
//下拉菜单监听
jcombox.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
jcombox_ActionEvent(e);
}
});
//Today单选监听
today_radioButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
today_radioButton_ActionEvent(e);
}
});
//下拉菜单监听
private void jcombox_ActionEvent(ItemEvent e){
if(e.getStateChange()==ItemEvent.SELECTED)
{
//添加出发事件
AA=(String) jcombox.getSelectedItem();//所选取的设备名称
}
}
//Today单选监听
private void today_radioButton_ActionEvent(ActionEvent e) {
// TODO Auto-generated method stub
//添加出发事件
}
时间: 2024-11-02 16:53:49