This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Help with parameters for JOptionPane.showMessageDialog

 
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
 
Bartender
Posts: 3648
16
Mac OS X Firefox Browser 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.
 
Marshal
Posts: 65760
250
  • 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.
 
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
Marshal
Posts: 65760
250
  • 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
Marshal
Posts: 65760
250
  • 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
 
Get off me! Here, read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!