如果用下拉菜单控制文本框?

2025-05-24 04:36:33
推荐回答(2个)
回答1:

点击下拉列表改变事件,当点击改变时,设置文本框为空,给你给列子自己看看,不明白给我消息

public void jComboBox1_actionPerformed(ActionEvent e) {
String temp = this.jComboBox1.getSelectedItem().toString();
if(temp.trim().equals("文本显示,你点击了我"))
{
this.jTextArea1.setText("文本显示,你点击了我");
}else{
this.jTextArea1.setText("");
}
}
}

回答2:

判断里面的值