Swingでコンボボックスの整数値を取得する必要があります。Java Swingでコンボボックスの値を取得
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;
}
:
以下は私のコードです。
だから、どのように設定しましたか? – nullpotent
問題を示す[SSCCE](http://sscce.org/)を投稿してください。 – tenorsax
更新が不完全です。 'projectId'の型は何ですか? – trashgod