Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with parameters for JOptionPane.showMessageDialog

 
Jeff Ciaccio
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried entering the following but I get an error:


The specific error is:
C:\Users\Dad\Documents\NetBeansProjects\CS8625\ParallelSpeedUpTutorial\src\com\yahoo\jeffciaParallelSpeedup\ParallelSpeedupGUI.java:631: cannot find symbol
symbol : variable frame
location: class com.yahoo.jeffciaParallelSpeedup.ParallelSpeedupGUI
JOptionPane.showMessageDialog(frame,"Eggs are not supposed to be green.","A plain message", JOptionPane.PLAIN_MESSAGE);
Note: C:\Users\Dad\Documents\NetBeansProjects\CS8625\ParallelSpeedUpTutorial\src\com\yahoo\jeffciaParallelSpeedup\ParallelSpeedupGUI.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
BUILD FAILED (total time: 0 seconds)

I think the problem is the first parameter. Can somebody please help me understand what the first parameter is?

Thanks
 
K. Tsang
Bartender
Posts: 3521
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jeff, what is the first parm for the JOptionPane.showMessageDialog()? According to the API it's a "component". Now you put in "frame" and this variable not found. Then does your code have such variable? If no, you can put in null and it will compile.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That first parameter is the Component over which the dialog window is to appear. If you write null the dialog window will appear in the centre of the screen. Beware: it may hide "behind" other windows.
 
Jeff Ciaccio
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. It turned out to be a problem just before this line of code, but all is well now.
 
Travis Roberts
Ranch Hand
Posts: 54
C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Ciaccio wrote:Thanks. It turned out to be a problem just before this line of code, but all is well now.



What is the fix?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Travis Roberts wrote:What is the fix?
Quite right. It is always useful to know how somebody sorted out their problem; the solution is there in case anybody else has the same problem in future.

And welcome to JavaRanch
 
Jeff Ciaccio
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a casting problem. I had a double but it was expecting an integer.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50240
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
Jeff Ciaccio
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you - I apprecitate the help. Sorry I didn't post this earlier.

- Jeff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic