Swingでコンボボックスの整数値を取得する必要があります。
コンボボックスのIDとして整数値を設定しました。combobox.getSelectedItem()とcombobox.getSelectedIndex()を試しましたが、int値を取得できません。
以下は私のコードです:
CommonBean commonBean[]=new CommonBean[commonResponse.getCommonBean().length+1];
for(int i=0;i<commonResponse.getCommonBean().length;i++)
{
commonBean[i] = new CommonBean("--Please select a project--", 0);
commonBean[i+1] = new CommonBean(commonResponse.getCommonBean()[i].getProjectName(), commonResponse.getCommonBean()[i].getProjectId());
}
JComboBox combobox= new JComboBox(commonBean);
public CommonBean(String projectName,int projectId) {
this.projectName = projectName;
this.projectId = projectId;
}
どんな助けでも大歓迎です。