0

Im trying to put two condition where the users pick selection in radiobutton "r1" and combobox "wdr1" and i want it to display picture output. But it didnt produce any output since the program can run it. Any suggestion to fix this?

if("r1".equals(combo2.getSelectedItem().equals("wdr1"))){

                icon1 = new ImageIcon("adidas.jpg");
                pic1.setIcon(icon1);
            }
azrai
  • 1
  • 1
    `combo2.getSelectedItem().equals("wdr1")` is a boolean, and you are checking if "r1" (a string) is equal to it. What is it that you are really trying to check? – Bar Hoshen May 16 '20 at 10:38
  • oh i thought r1 will be equal to combo2 if combo2 get pick, but if i used logical operator still didnt come out: if("r1".equals("White") || combo2.getSelectedItem().equals("wdr1"))){ icon1 = new ImageIcon("adidas.jpg"); pic1.setIcon(icon1); } – azrai May 16 '20 at 11:21
  • Now you have one too many or the `)` symbols. Also just be aware that you are using the OR operator and not AND. If you need both conditions to be met, you && instead of ||. – Bar Hoshen May 16 '20 at 11:34

0 Answers0