
-----------------------------------
ToughRouge
Mon Nov 12, 2007 12:44 am

Dialog Box Help Request
-----------------------------------
Hi,
I'm having problems with creating a dialog box. 
I want to create a dialog box to basically inform the user of the error in their input (ex. Non-numerical input). 


public double getX1Input () {
		double dblX1 = 0;
		while (true) {
			try {
				dblX1 = checkNegativeZero(Double.parseDouble(txtX1.getText()));
				break;
			}
			catch (NumberFormatException e) {
				//JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.");
			      JButton buttonOK = new JButton("OK"); 
			      JOptionPane.showMessageDialog(buttonOK, JOptionPane.INFORMATION_MESSAGE); 
			}
		}
		return dblX1;
	}


There is an error on the JOptionPane.showMessageDialog line. 
If anyone could help me out with this, it would be greatly appreciated.
Thanks in advance.

-----------------------------------
HeavenAgain
Mon Nov 12, 2007 11:37 am

RE:Dialog Box Help Request
-----------------------------------
http://compsci.ca/v3/viewtopic.php?t=1843
a good tut made by Dan about Swing, have a look at that, im sure it will solve your problem :|

and your problem is at this line?
 //JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green."); 
you didnt say what type of Message Dialog box you want, 
so to fix it, it should be something like
 catch (NumberFormatException e) {
//JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.",JOptionPane.INFORMATION_MESSAGE);
} 
:roll: i think
