在Java中的JComboBox中确定用户选择的项目?

时间:2014-09-18 18:01:26

标签: java swing netbeans jcombobox

如何在JComboBox

中确定用户选择的项目

我试过这段代码:

double combofir = Integer.parseInt(jComboBox1.getSelectedItem().toString());
    // in this line how can I set the item that I want to know?

 double x = Integer.parseInt(jTextField1.getText());
 double combosec = Integer.parseInt(jComboBox2.getSelectedItem().toString());
 if (combofir == combosec) {
     double a = 72.873;
     double result = x*a;
     jTextField2.setText(""+result);

 } 

0 个答案:

没有答案