Java exceptions pop up window
<p>My question is how do I make a pop up message when a user puts in the wrong input, it has to do with filling in the right string (rood, groen, oranje) with the right colour, but when he doesnt put anything in the textfield or the wrong name (string) it should return an error with a popup window.</p>

<p>Snippet below:</p>

<p>Java class snippet:</p>

<pre><code>    int Kleurteller;
    for (Kleurteller = 1; Kleurteller &lt;= 7; Kleurteller++) {
        if (kleur != null) {
            if (kleur.equals("rood")) {
                g.setColor(Color.red);
                g.fillOval(795, 45, 30, 30);
            } else if (kleur.equals("groen")) {
                g.setColor(Color.green);
                g.fillOval(795, 45, 30, 30);
            } else if (kleur.equals("oranje")) {
                g.setColor(Color.orange);
                g.fillOval(795, 45, 30, 30);
            }
            else {
            try{}
            catch (Exception e){
            JOptionPane.showMessageDialog(null, "geen juiste kleur opgegeven, kies rood, groen of oranje");

            }

            }

        }
    }
</code></pre>

<p>In my mainclass i have a path to the file so it will run it. (SetContentPane).</p>

<p>Currently does not show the redlines anymore when a user put the wrong things in the textfield. Dont get a pop up screen, which i need for my program</p>