• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error do you get? Please copy-and-paste it here so we can explain what it means.

Layne
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic