Validating a JOptionPane ConfirmDialog I use this code to make sure that the user didn't leave the combo box empty before pressing OK

            int option=-1;
            while(cboFruits.getSelectedItem() == null){
             option = JOptionPane.showConfirmDialog(null, message, "Fruits", JOptionPane.OK_CANCEL_OPTION);
             if (!(option == JOptionPane.OK_OPTION))                 
                 break; 
             if(cboFruits.getSelectedItem() == null)             
                 JOptionPane.showMessageDialog(null, "Select a fruit");             
            }


Is there a better alternative to this that doesn't involve creating my own Dialog? The combo box gets filled with data when another combobox changes its value, so putting a value by default is not an option.
Your approach seems fine. But some minor improvements are possible:


It's unnatural to write !(x == y), the more natural way is x != y
I'm wondering if option is needed outside the loop are all. If not, then you should declare and initialize it inside the loop. 
in every iteration, you check cboFruits.getSelectedItem()== null twice: once after the use clicked OK, and then again in the loop condition. It would be better to rearrange this code in a way that the condition is checked once per iteration.
It's recommended to use braces always, even with single line if statements