• Post Reply Bookmark Topic Watch Topic
  • New Topic

is it possible to check two different combo boxes to give one result?  RSS feed

 
Liam Rice
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone, so i need to check two combo box selections and if they are met then i will print a result relating to the two combo box selections. This is what i have got so far but it doesn't work, can someone please help?




i want to check if cmbCurrency has EUR selected and cmbCurrencyTo also has GBP selected at the same time then it will print a double value into a text field... but only when these two values are selected at the same time. is this possible?
Thank you
 
Knute Snortum
Sheriff
Posts: 4281
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it can be done and it's quite common.  Except for the stray "]" character, the if statement looks good.
it doesn't work

Could you be more specific?  Does that mean the value you're expecting doesn't appear in a textbox?  If you're executing the program in a way that you can see the command line or window, try add a System.out.println(...) statement to see if the value is correct, or if you're even hitting the line where you set the text.  
 
Rob Camick
Ranch Hand
Posts: 2828
15
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quit reposting questions: https://coderanch.com/t/680010/java/currency-converter-working

You were already asked in your last question what "doesn't work" means.

You were also given a suggestion on how to debug your code. You still haven't added any debug cod to see if you if statement is invoked or not.

So pay attention to answers already given and do some basic debugging on your own.



 
Liam Rice
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:Quit reposting questions: https://coderanch.com/t/680010/java/currency-converter-working

You were already asked in your last question what "doesn't work" means.

You were also given a suggestion on how to debug your code. You still haven't added any debug cod to see if you if statement is invoked or not.

So pay attention to answers already given and do some basic debugging on your own.





im asking different things...
 
Dave Tolls
Ranch Foreman
Posts: 3065
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JComboBox only allows one selection, so that if statement can't work.

What is it you are trying to achieve?
 
Knute Snortum
Sheriff
Posts: 4281
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liam Rice wrote:im asking different things...

But they can be solved in a similar way.
  • Don't say, "It doesn't work."  Instead TellTheDetails (that's a link)
  • Put debugging lines in your code
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!