right if command

i have created a jcombobox which i have named pricerate here is its codepricerate =new JComboBox(priceStrings);pricerate.setSelectedIndex(0); pricerate.addActionListener(this);

String[] priceStrings ={"hour","Daily","Weekly","Monthly","Annual"};

im using the following if command to try and get some joptionpanes to be displayed when the user selects hour as the value and presses a submitbuttonif ("pricerate"(myString.equals("hour"))

does anyone know if this is the right way of creating the if command and if not what i need to change

[898 byte] By [jonathanca] at [2007-11-27 10:56:23]
# 1

sorry about the code up top being scattered as well a bit my enter button on my computer is not working

jonathanca at 2007-7-29 12:02:38 > top of Java-index,Java Essentials,Java Programming...
# 2

What's it supposed to do?

georgemca at 2007-7-29 12:02:38 > top of Java-index,Java Essentials,Java Programming...
# 3

Should probably be something more to the effect of

if (((String)pricerate.getSelectedItem()).equals("hour")) {

}

but then again, since you have then in an array anyway, you may prefer to do something to the effect of

if (((String)pricerate.getSelectedItem()).equals(priceStrings[index])) {

}

masijade.a at 2007-7-29 12:02:38 > top of Java-index,Java Essentials,Java Programming...
# 4

as you can see hour daily etc are going to be displayed on the jcombo box when the user chooses hour and when he clicks the submit button a few joption panes should be displayed.

jonathanca at 2007-7-29 12:02:38 > top of Java-index,Java Essentials,Java Programming...