Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 470
  • Last Modified:

Using JavaFx classes in a regular Java program

I'm new to Java and found the NetBeans IDE to be more of my taste.  

With that context taken care of, I started up a simple project on the standard library (again, this is without much knowledge so I'm assuming default is standard, I can get to swing/awt stuff fine).

I have learned that the default sound access doesn't allow you to load mp3 files, and I am trying to avoid rolling my own api.  I did however, find that JavaFx has a class that specifically does this (Media) and would like to include it in the project.

First problem is, although I can open up a new JavaFx application, that's not what I want.  I want to import JavaFx and use that specific class only.  I am failing horribly to find a way to do that with NetBeans.

Second problem is, I'm looking for the Visual Studio equivalent of add reference - and do not know where to begin looking in NetBeans.
0
larrysy
Asked:
larrysy
1 Solution
 
Tomas Helgi JohannssonCommented:
Hi!

You could try open a new regular Java Application and then go to the Library section to Import the JavaFX library.
This is done automatically for you when you create a new JavaFX appliaction as well doing some other configuration that could be necessary.

Here are some JavaFX examples
http://www.java2s.com/Code/Java/JavaFX/MediaPlayer.htm
http://www.java2s.com/Code/Java/JavaFX/Media.htm
http://www.java2s.com/Code/Java/JavaFX/CatalogJavaFX.htm

For the second I think what you are looking for is in the Projects property section (just right click on your project and chose "Properties" )

Regards,
    Tomas Helgi
0
 
GreggCommented:
Have a look at this as well...

How to Play an MP3 File in Java

Plays an MP3 file using the JLayer MP3 library.
 http://www.javazoom.net/javalayer/sources.html
0
 
larrysyAuthor Commented:
Thanks Tomas,

The answer to the second question is what ultimately led to me finding the necessary .java files to solve the first question.  For some reason JavaFx doesn't register as one of the Global Library packages.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now