Results 1 to 8 of 8
  1. #1
    JavaNoob!1 is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default Help with javaFX?!

    I'm trying to code a media player with javaFX. Is it possible to internalize the media being played into a window? An example would be if there is dedicated space for the video and then when you click on an item it plays within the window. Basically youtube but with saved videos already there.

  2. #2
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default Re: Help with javaFX?!

    I think that is possible.

    Maybe this links might be helpful:

    How to make movie player using Java / JavaFX? - YouTube

    Harmonyfx - JavaFX media Player - YouTube

  3. #3
    JavaNoob!1 is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default JavaFX and normal Java

    I have created a GUI in normal java code, and now I have created a media player that plays video in JavaFX. When I try start the media player in the normal application, even though JavaFX is part of the package it can't run the media player and when the GUI is started in the JavaFX application it can't start.

    If anyone can share some light on this, it would be greatly appreciated.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: JavaFX and normal Java

    What do "it can't run" and "it can't start" mean?
    What is it you are seeing that is wrong?
    Any exceptions (including full stack traces)?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    JavaNoob!1 is offline Member
    Join Date
    Jul 2012
    Posts
    4
    Rep Power
    0

    Default Re: JavaFX and normal Java

    I have a media player class, here:

    XML Code:
    public class player extends Application{
        
        @Override
        public void start(final Stage stage) throws Exception {  
           //CONTENTS NOT APPLICABLE TO SITUATION
    }
    I have a main menu, where I wish to launch the mediaplayer:

    XML Code:
    public class VA_MainMenu extends javax.swing.JFrame {
        public VA_MainMenu() {
            initComponents();
        }
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        Stage stage = null;
        player play = new player();
            try {
                play.start(stage);
            } catch (Exception ex) {
                Logger.getLogger(VA_MainMenu.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
    I then get the following error when I click the button:

    Jul 18, 2012 7:03:24 PM VSA.VA_MainMenu jButton1ActionPerformed
    SEVERE: null
    java.lang.NullPointerException

    But when I run the same code in the JavaFX environment like this (obviously without the try/catch because the method throws the Exception):

    XML Code:
    public class Main extends Application {
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            launch(args);
        }
        
        @Override
        public void start(Stage stage) throws Exception {
            player play = new player();
            play.start(stage);
        }
    }
    The media player opens. Which leaves the question: Is it at all possible for me to launch the media player from an environment where there's a button?
    Much appreciated.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,250
    Rep Power
    19

    Default Re: JavaFX and normal Java

    Yes, it's possible, but you have to take care of the threading issues. Go through JavaFX for Swing Developers: About This Tutorial | JavaFX 2 Tutorials and Documentation

    In future, please post JavaFX questions in the JavaFX section.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,250
    Rep Power
    19

    Default Re: Help with javaFX?!

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,250
    Rep Power
    19

    Default Re: JavaFX and normal Java

    Seeing as a related question was already asked, I''m merging the two threads.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Eclipse JavaFX Support
    By mlpehlivan in forum Eclipse
    Replies: 1
    Last Post: 03-11-2012, 01:44 PM
  2. JAVAFX 2.0 popup menu
    By bockymurphy in forum JavaFX
    Replies: 0
    Last Post: 01-12-2012, 02:10 AM
  3. JavaFX not able to read images
    By ajeeb in forum NetBeans
    Replies: 4
    Last Post: 02-16-2010, 03:16 PM
  4. Mysql and JavaFX
    By cjr9968 in forum JDBC
    Replies: 11
    Last Post: 01-29-2010, 02:51 AM
  5. JavaFX Script and JavaFX Mobile
    By levent in forum Java Software
    Replies: 1
    Last Post: 01-27-2010, 04:48 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •