i am working on making a scientific calculator in netbeans using wing components and i used combo box for conversion purpose but the handler code i wrote isnt working for all conversion, it only works for the 1st item.
and please help me with "action" and "item" on the right click of event option in netbeans.
my code is

a = Double.valueOf(String.valueOf(display.getText()));

if(jComboBox1.getSelectedItem().equals("Convert TIME ( Minutes to Seconds)"))

{
    double b;
    b = a*60;

       display.setText( ""+ b);
       display.setBackground(Color.blue);

}
if(jComboBox1.getSelectedItem().equals("Convert TIME (Seconds to Minutes"))
{
    double x;

  x = a/60;
 display.setText( ""+ x);
 display.setBackground(Color.red);


}

this code is under the action option i.e events-> action and in that method i wrote this code please do help me so that i could write the whole code for all conversions
plz reply ASAP....

what do you mean: is only working for the first?
what happens if you use a next one? is there an error message? add some print statements through the code to see what happens/is executed.

also: do understand that using it like that, you might easily mistype one of those Strings... one uppercase where it should be lower, one space where none should be, en equals will return false, so the action won't be performed.

one way to avoid this, is to compare by getSelectedIndex() instead of getSelectedItem();

getSelectedItem() is good if you actually have to use the selected value, which you don't.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.