• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The method showMessageDialog(Component, Object) in the type JOptionPane is not applic

 
FairGhost
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the code n its giving me the following error and even in bok code is correct same i haev have here, if some one can help
Thanx
import javax.swing.JOptionPane;
public class Compersion
{
public static void main (String args[])
{
int num1,num2;
String firstnum, secondnum, result;

firstnum = JOptionPane.showInputDialog("Enter First Number");
secondnum = JOptionPane.showInputDialog("Enter Second Number");

num1 = Integer.parseInt( firstnum);
num2 = Integer.parseInt( secondnum);

result = "";

if (num1 == num2)
result = result + num1 + "==" +num2;

if (num1 != num2)
result = result + num1 + "!=" +num2;

JOptionPane.showMessageDialog(null, result, "Compersion Results");
System.exit( 0);
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking in the JOptionPane api for the showMessageDialog methods I see three listed in the Method Summary section. None of them take three arguments.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What error do you get? Please copy-and-paste it here so we can explain what it means.

Layne
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mr. Ghost,

Welcome to JavaRanch!

You apparently missed reading our naming policy on your way in. It requires that your display name be a full, real, first and last name. Joke names and "handles" aren't acceptable here. You can change your display name here. Thanks.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Layne Lund:
What error do you get? Please copy-and-paste it here so we can explain what it means.

Layne


Hmm...I see that you tried to put the error message in the subject. However, it was truncated so we cannot see it all. Craig posted a basic explanation of what is wrong, but if you still need help, please post the full error message again. We'll be glad to help you from there.

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic