Erik Price
Posts: 39
Nickname: erikprice
Registered: Mar, 2003
|
|
Re: To: Erikprice
|
Posted: May 6, 2003 4:53 AM
|
|
Brandon you are really close.
Remember when you post some code if something doesn't work, that you should post the error message you get, since that can help identify the problem quickly. In this case, it's a "symbol not found" compiler error. This usually indicates that you've used a method, class, or other name that is unknown to the compiler. Often this is the result of not importing the right classes, but in this case, you've imported all the right classes.
The error messages are listed as this:
Convert3.java:18: cannot resolve symbol symbol : method showInputDialog (<nulltype>,java.lang.String,int) location: class javax.swing.JOptionPane JOptionPane.showInputDialog ( ^ Convert3.java:31: cannot resolve symbol symbol : method showMessgeDialog (<nulltype>,java.lang.String) location: class javax.swing.JOptionPane JOptionPane.showMessgeDialog(null, "ERROR, Please enter another number."); ^
Those two error messages are both saying the same thing: the compiler has no idea where you're getting the method names from. In other words, the JOptionPane.showInputDialog(<nulltype>,java.lang.String,int) method is unknown to the compiler, and the JOptionPane.showMessgeDialog(<nulltype>,java.lang.String) method is unknown to the compiler.
If you check the JOptionPane Javadoc, you'll see that there's six methods named "showInputDialog":
showInputDialog(Component?parentComponent, Object?message)
showInputDialog(Component?parentComponent, Object?message, Object?initialSelectionValue)
showInputDialog(Component?parentComponent, Object?message, String?title, int?messageType)
showInputDialog(Component?parentComponent, Object?message, String?title, int?messageType,
Icon?icon, Object[]?selectionValues, Object?initialSelectionValue)
showInputDialog(Object?message)
showInputDialog(Object?message,Object?initialSelectionValue)
Yet none of them conform to the signature that you've used. I think that the one you might have meant to use is the third one:
showInputDialog(Component?parentComponent, Object?message, String?title, int?messageType)
It uses the parentComponent (which in your code is going to be null since you're not using a parent component), the message itself, a title for the JOptionPane, and the message type. All you need to add is the title.
As for the second error message, if you look really closely at the error message I think you'll see what's wrong. Hint: there's no way that the showMessgeDialog method will be found by the compiler in any of the standard libraries. :)
Good luck.
|
|