Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Dialog Box Help Request
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ToughRouge




PostPosted: Mon Nov 12, 2007 12:44 am   Post subject: 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).

Quote:

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.
Sponsor
Sponsor
Sponsor
sponsor
HeavenAgain




PostPosted: Mon Nov 12, 2007 11:37 am   Post subject: 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 Neutral

and your problem is at this line?
code:
//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
code:
catch (NumberFormatException e) {
//JOptionPane.showMessageDialog(frame, "Eggs are not supposed to be green.",JOptionPane.INFORMATION_MESSAGE);
}

Rolling Eyes i think
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: