im a newbie in java and i just want to know why the code below doesnt work. everytime i press cancel or i pick an image from the open dialog box, the open dialog box opens again instead of closing it.
[ArchAngel added CODE tags]Code:public void itemStateChanged(ItemEvent ie) { JButton b = (JButton) e.getSource(); Object s = dropdown.getSelectedItem(); if (s == "Open") { JFileChooser s= new JFileChooser(); int t = s.showOpenDialog(this); if (t == JFileChooser.APPROVE_OPTION) { ImageIcon image = new ImageIcon(s.getSelectedFile().getAbsolutePath()); pictures[totalpics] = image; totalpics++; } else if (t == JFileChooser.CANCEL_OPTION) { pictures[totalpics] = null; } } resetImage(pictures[currentposition]); }


Reply With Quote


Bookmarks