JonathanGiles / jonathangiles.net-comments

0 stars 0 forks source link

posts/2009/javafx-magic-8-ball/index #134

Open JonathanGiles opened 4 years ago

JonathanGiles commented 4 years ago

JavaFX Magic 8 Ball

https://jonathangiles.net/posts/2009/javafx-magic-8-ball/

JonathanGiles commented 4 years ago

Auto-imported comment, original author: tbee Comment posted on: June 19, 2009

But an image doesn't scale well, jonathan. Tssk tsssk tsssk ;-)

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Jonathan Comment posted on: June 20, 2009

@tbee: The homework for the reader is to create the background in JavaFX :-) I was rushing to finish the demo with only a tiny amount of time available to do it in. In reality to create the ball all in JavaFX wouldn't be difficult, although scaling the magic 8 ball app to work on a mobile phone would probably provide other issues, particularly around displaying the text (it'll be too small).

Make a mobile version, using the code in this post as a starting point. It should be an interesting experiment.

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Joe Comment posted on: March 18, 2010

Not able to offer any help here but I have a question. I was curious if I could modify the code and recompile it myself. I am a complete noob here and do not know what would be required to do so. Any help? I simply want to change the sayings that the ball produces for a joke...

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Jonathan Comment posted on: March 18, 2010

Sure - you'll be best served to download NetBeans with the JavaFX SDK and plugin, then simply download the linked source code and load it up in NetBeans.

Good luck, and have fun! :-)

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Joe Comment posted on: March 18, 2010

Nice! I changed the code, got it compiled and got it running with my custom comments. Now I need to figure out how to make something I can email to people to run on their windows machines or perhaps something I can put in a web page or something! This is cool. Any advice on where to go from here? A link to a tutorial about how to export and use the project?

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Jonathan Comment posted on: March 18, 2010

Steal the jnlp link from my page and edit it to point to your own webserver, then upload the jar file generated by NetBeans (which is in your projects 'dist' folder).

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Joe Comment posted on: March 19, 2010

Perfect. Thanks again for your help. It's working great!

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Karson Comment posted on: February 7, 2011

Hey there I was just wondering is it possible to have it play a specific sound when shaken. I am creating one for some friends of mine who I play World of Warcraft with. I want to make it a magic 8 ball the decides what raid our guild will be doing. How ever seeing as the text display is random is it possible to make it so that a certain sound belongs to a certain text yet the text is randomly generated. So lets say I shake it and get a response that says "Maybe" the sound played would say "maybe" but if i shake again and it says "ask later" the sound says "ask later". I guess I am just asking is it possible to match the sound with the text so they always match each other. I wouldn't want to get a text response of "maybe" and a sound response of "ask later"

JonathanGiles commented 4 years ago

Auto-imported comment, original author: Jonathan Comment posted on: February 8, 2011

Yes, you can easily add code to sync up a sound effect with a given message, or just change the messages to suit your needs.