- #1
BiGyElLoWhAt
Gold Member
- 1,622
- 131
Code:
else if(e.getSource() == add)
{
try{
int redInt = Integer.parseInt(red.getText());
int greenInt = Integer.parseInt(green.getText());
int blueInt = Integer.parseInt(blue.getText());
String s = (String)JOptionPane.showInputDialog("Enter Your Color Name");
colorPane.addColor(redInt, greenInt,blueInt, s);
}
catch(Exception ex)
{
System.out.println("You must enter a number in all fields!");
}
}
I call this with a button (add) and it all works fine, however, when I hit ok, it adds the color, but brings the menu popup back as if I had just hit the add button. If you hit ok the second time, though, it goes away. What am I missing? If you need any other code snippets let me know.