USB application in JavaFX

Hi all,
I am trying to build a cross platform (vista, xp, mac
computers for now) and mobile phone in the future. The
application needs to run from a usb flash drive.
Is this something I can do with JavaFX? Currently I am
thinking of a Swing application with an embedded jre (in the
flash drive).
Any thoughts? suggestions?
Thanks
sunil2rao

Hi,
I think you should write a library in c or c ++ for your specific OS, after you can use it throw JNI (java native interface) or simplier JNA (java native access).
For Windows / Linux cross platform library you can use MinGW ang gcc with netbeans c++ pack, it's working quite good -), don't know on Solaris and Mac.
I'd use it, tell me if you need more info.
Bye!

Similar Messages

  • A RCP Application using javafx deployed by java web start,in jre8u25 run have problem.

    a RCP Application using javafx deployed by java web start,in jre8u20 can use jre7run the applicat,but in jre8u25 use jre7run application have problem.
    in jre8u20 use jre7 run the application can run success.
    but in jre8u20 the control print:
    java.lang.UnsupportedClassVersionError: com/sun/javafx/runtime/VersionInfo : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at com.sun.deploy.config.JfxRuntime.runtimeForPath(Unknown Source)
    at com.sun.deploy.config.JREInfo.<init>(Unknown Source)
    at com.sun.deploy.config.JREInfo.setInstalledJREList(Unknown Source)
    at com.sun.deploy.config.ClientConfig.storeInstalledJREs(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    the reason (i think) is that the application will use javafx's com.sum.javafx.runtime.VersionInfo,i use e(fx)clipse load the javafx runtime.in jre8u20,the web start use jre7's class.in jre8u25,the web start use jre8's class.
    so i use jre7 run the application get this result.
    how could i solve this problem?

    Hi,
    I have created client stubs for a webservice using axis wsdl2java tool. When I try calling these stubbed methods from JUnit tests, they are working fine but when I try to execute the jar (it is a swing) I get the following exception:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/rpc/Service
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at com.Gudds.SeCURE.MainUI.<init>(MainUI.java:76)
    at com.Gudds.SeCURE.Main.Start(Main.java:62)
    at org.owasp.webscarab.WebScarab.main(WebScarab.java:34)
    I have put the jaxrpc.jar in the classpath and I suppose this jar has the java.xml.rpc.service class but I donot understand why it fails while executing the jar but works fine from the eclipse IDe. Plase help me.
    Regrdas,
    Kundan

  • Create form based applications using javafx in NetBeans 6.5

    Hi Friends,
    I am a beginner in javafx and want to create a form based application using javafx. I saw in some of the tutorials that forms were created using frames. But when i started developing this, there is no package for frame. Can anyone help me out from this problem.Code for a simple login application can get me out of this.I am using NetBeans 6.5 version.
    Thanks in advance
    Sherlyn

    See an example for the PasswordField component.

  • Probleme application bundle javaFx mac osx

    Hi,
    I have developed an javafx application (netbeans 7.1.2). When I execute the jar file in the dist folder, the application launch and works fine.
    I tried to bundle it with jar bundler but when I launch the application I have this message :
    JavaFX 2.1.0 is required to view this content but JavaFX. Get the JavaFX runtime from java.com/javafx and run the installer. Then restart the application.
    I can't understand why...

    Hi,
    I have developed an javafx application (netbeans 7.1.2). When I execute the jar file in the dist folder, the application launch and works fine.
    I tried to bundle it with jar bundler but when I launch the application I have this message :
    JavaFX 2.1.0 is required to view this content but JavaFX. Get the JavaFX runtime from java.com/javafx and run the installer. Then restart the application.
    I can't understand why...

  • Netbeans Platform Application and JavaFX CSS API

    I'm using JavaFX in my Netbeans Platform Application. I load JavaFX scene with next code:
    SwingUtilities.invokeLater(new Runnable()
                    @Override
                    public void run()
                        javaFxPanel.setSize(getSize());
                        add(javaFxPanel, BorderLayout.CENTER);
                        Platform.runLater(new Runnable() {
                            @Override
                            public void run() {
                                    Group branchNode = new Group();
                                    Scene scene = new Scene(branchNode);
                                    try{
                                        scene.getStylesheets().add("C:\\Xlab\\pandora\\branches\\simon-welcome-screen\\TraineeGuiApp\\modules\\ui\\welcomescreen\\main.css");
                                    catch(Exception e)
                                       Exceptions.printStackTrace(e);
                                    Rectangle rect = new Rectangle(100,100);
                                    rect.setLayoutX(50);
                                    rect.setLayoutY(50);
                                    rect.getStyleClass().add("my-rect");
                                    ((Group)scene.getRoot()).getChildren().add(rect);
                                    // Add scene to panel
                                    javaFxPanel.setScene(scene);
                                    javaFxPanel.setVisible(true);
                        //Application.launch(FXApplication.class, null);
                });As you can see i provide absolute path to my css file. CSS file and class that i want to use it from are in same package. I also tried providing just a "main.css" string to scene.getStylesheets().add("main.css"); method.
    I have no idea why this is not working. Any suggestions?
    Edited by: user8867321 on 1.9.2011 9:56

    Admittedly, the stylesheet path handling is pretty bad. If you can see the .css file in your browser, then you have a valid URL. You can also use Class.getResource("blah").toExternalForm() to get the right URL string. For example, if I have my .css file in the same directory as Main.java, then I could do scene.getStylesheets().add(Main.class.getResource("sample.css").toExternalForm());

  • CDC Application with JavaFX

    Hello,
    I am trying to embed a JavaFX scene in swing JComponent as shown below:
    import java.awt.*;
    import javax.swing.*;
    import org.jfxtras.scene.SceneToJComponent;
    public class Main extends JFrame {
    public static JTextField tf = new JTextField("JavaFX for SWING");
    public Main() {
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("JavaFX in SWING Test");
    Container container = getContentPane();
    container.setLayout(new BorderLayout());
    String sceneClass = "cdcapplication13.MyScene";
    JComponent myScene = SceneToJComponent.loadScene(sceneClass);
    JLabel label = new JLabel(" Below is a JavaFX Animation: ");
    container.add(label, BorderLayout.NORTH);
    container.add(myScene, BorderLayout.CENTER);
    JPanel p = new JPanel();
    p.setLayout(new FlowLayout());
    tf.setColumns(28);
    p.add(tf);
    p.add(new JButton("SWING Button"));
    container.add(p, BorderLayout.SOUTH);
    pack();
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(
    new Runnable() {
    public void run() {
    new Main().setVisible(true);
    In the above cdcapplication13.MyScene is my JavaFX scene class. The above worksfine is a desktop application. However, when trying to do the same on a CDC application with Emulator platform - CDC Java(TM) Platform Micro Edition SDK 3.0, Device - SunVgaAGUIPhone1 and Device Profile - PBP-1.1, I get the following exception when running to app:
    nsicom-run:
    ODT agent stopped.
    java.lang.SecurityException: no manifiest section for signature file entry javax/crypto/KeyGeneratorSpi.class
    at sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:278)
    at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:190)
    at java.util.jar.JarVerifier.processEntry(JarVerifier.java:259)
    at java.util.jar.JarVerifier.update(JarVerifier.java:214)
    at java.util.jar.JarFile.initializeVerifier(JarFile.java:270)
    at java.util.jar.JarFile.getInputStream(JarFile.java:332)
    at sun.misc.Launcher$AppClassLoader.defineClassPrivate(Launcher.java:544)
    at sun.misc.Launcher$AppClassLoader.access$500(Launcher.java:344)
    at sun.misc.Launcher$4.run(Launcher.java:565)
    at java.security.AccessController.doPrivileged(AccessController.java:351)
    at java.security.AccessController.doPrivileged(AccessController.java:320)
    at sun.misc.Launcher$AppClassLoader.doClassFind(Launcher.java:559)
    at sun.misc.Launcher$AppClassLoader.findClass(Launcher.java:607)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:349)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:420)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:338)
    at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:603)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:291)
    at com.sun.cdc.odt.CdcAppManager.runMain(CdcAppManager.java:168)
    at com.sun.cdc.odt.CdcAppManager.access$100(CdcAppManager.java:44)
    at com.sun.cdc.odt.CdcAppManager$1.run(CdcAppManager.java:90)
    at java.lang.Thread.startup(Thread.java:782)
    Can anyone please tell me how to fix this issue?
    Thanks!

    Welcome to the forum. Please don't post in threads that are long dead and don't hijack other threads. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
    I'm locking this thread now.

  • Calling applications from javafx

    hi,
    how to call other application such as winamp, firefox, etc from javafx.

    Have a look at the documentation of java.lang.ProcessBuilder [http://java.sun.com/javase/6/docs/api/java/lang/ProcessBuilder.html]
    General pointer for processes in Java:
    - you DO need to consume the content of the standard output and error output (if any) in order for your app to execute correctly.
    - "consuming" means empting their content (getting rid of it, saving it to a log, exporting it to the GUI, whatever). Can be done in separate Thread or task (see FX pointers below).
    - standard ouput stream is returned by getInputStream() in the Process class (I know the name is misleading but from Java's point of view, the process' output is an input stream).
    - error ouput stream is returned by getErrorStream() in the Process class (same)
    Pointers for processes in JavaFX:
    - use javafx.async.JavaTaskBase and javafx.async.RunnableFuture to create an async FX task to start & launch the process and to consume its streams.

  • Deployment of JavaFX Web application on client machine(Windows OS.)

    Problem Statement:
    Deployment of JavaFX Web application on client machine(Windows OS.)
    Error: unable to load the native libarary(JNI Windows dll) i.e. throws java.lang.UnsatisfiedLinkError exception.
    Problem Description:
    I have create the JavaFX application which have dependency on Native library written in Java Native Interface(JNI).
    When the application is deployed on Apache 6.0 Tomcat Server(Copied .html file *.jnlp file and .jar file) and when client machine hit the html page in internet explorer version 8.0 its throws the following error(java.lang.UnsatisfiedLinkError: no JNIHelloWorld in java.library.path)
    Note:
    I have created the jar file which have my "JNIHelloWorld' native library dll in root directory. I have signed the jar with same signature which i have used for signing for my application Jar file.
    I have mentioned the native library jar in JNLP file resource keyword as follows:
    <resources os=Windows>
    <nativelib href="JNIHelloWorld.jar" download="eager" />
    </resources>
    The complete jnlp file content is in "JavaFXApplication.jnlp file:" section below.
    The description of error is as follows:
    Match: beginTraversal
    Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
    platform is: 1.7
    product is: 1.7.0_07
    location is: http://java.sun.com/products/autodl/j2se
    path is: C:\Program Files\Java\jre7\bin\javaw.exe
    args is: null
    native platform is: Windows, x86 [ x86, 32bit ]
    JavaFX runtime is: JavaFX 2.2.1 found at C:\Program Files\Java\jre7\
    enabled is: true
    registered is: true
    system is: true
         Match: ignoring maxHeap: -1
         Match: ignoring InitHeap: -1
         Match: digesting vmargs: null
         Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
         Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
         Match: digest LaunchDesc: http://10.187.143.68:8282/KPIT/JavaFXApplication20.jnlp
         Match: digest properties: []
         Match: JVM args: [JVMParameters: isSecure: true, args: ]
         Match: endTraversal ..
         Match: JVM args final:
         Match: Running JREInfo Version match: 1.7.0.07 == 1.7.0.07
         *Match: Running JVM args match: have:<> satisfy want:<>*
    *java.lang.UnsatisfiedLinkError: no JNIHelloWorld in java.library.path*
    *     at java.lang.ClassLoader.loadLibrary(Unknown Source)*
    *     at java.lang.Runtime.loadLibrary0(Unknown Source)*
    *     at java.lang.System.loadLibrary(Unknown Source)*     at javafxapplication20.JavaFXApplication20.<clinit>(JavaFXApplication20.java:41)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at com.sun.javafx.applet.FXApplet2.init(FXApplet2.java:63)
         at com.sun.deploy.uitoolkit.impl.fx.FXApplet2Adapter.init(FXApplet2Adapter.java:207)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Java Plug-in 10.7.2.11
    Using JRE version 1.7.0_07-b11 Java HotSpot(TM) Client VM
    User home directory = C:\Users\io839
    Please find my native library code and JavaFX application code:
    Native library JNI Code:
    JavaFXApplication.java:
    JNIEXPORT jstring JNICALL Java_javafxapplication_SampleController_printString(JNIEnv *env, jobject envObject)
         string str = "hello JNI";
         jstring jniStr = env->NewStringUTF(str.c_str());
         return jniStr;
    JavaFX Application code:
    JavaFXApplication.java:
    package javafxapplication;
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    public class JavaFXApplication extends Application {
    @Override
    public void start(Stage stage) throws Exception {
    Parent root = FXMLLoader.load(getClass().getResource("Sample.fxml"));
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
    * The main() method is ignored in correctly deployed JavaFX application.
    * main() serves only as fallback in case the application can not be
    * launched through deployment artifacts, e.g., in IDEs with limited FX
    * support. NetBeans ignores main().
    * @param args the command line arguments
    public static void main(String[] args) {
    launch(args);
    static{
    System.loadLibrary("JNIHelloWorld");
    SampleController.java file:
    package javafxapplication;
    import java.net.URL;
    import java.util.ResourceBundle;
    import javafx.event.ActionEvent;
    import javafx.fxml.FXML;
    import javafx.fxml.Initializable;
    import javafx.scene.control.Label;
    public class SampleController implements Initializable {
    @FXML
    private Label label;
    private native String printString();
    @FXML
    private void handleButtonAction(ActionEvent event) {
    System.out.println("You clicked me!");
    String str = printString();
    label.setText(str);
    @Override
    public void initialize(URL url, ResourceBundle rb) {
    // TODO
    //String str = printString();
    JavaFXApplication.jnlp file:
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="JavaFXApplication.jnlp">
    <information>
    <title>JavaFXApplication20</title>
    <vendor>io839</vendor>
    <description>Sample JavaFX 2.0 application.</description>
    <offline-allowed/>
    </information>
    <resources>
    <jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
    </resources>
    <resources>
    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="JavaFXApplication.jar" size="20918" download="eager" />
    </resources>
    <resources os=Windows>
    <nativelib href="JNIHelloWorld.jar" download="eager" />
    </resources>
    <security>
    <all-permissions/>
    </security>
    <applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="JavaFXApplication" >
    <param name="requiredFXVersion" value="2.2+"/>
    </applet-desc>
    <jfx:javafx-desc width="800" height="600" main-class="javafxapplication.JavaFXApplication" name="JavaFXApplication" />
    <update check="always"/>
    </jnlp>

    No problem.
    Make sure your resources are set at the proper location. Could be that tje jni.jar is under a 'lib' folder?
    Normally you don't have to worry about deployment a lot if you are using like Netbeans 7.2 or higher.
    When you press 'Clean and build' it creates your deployed files in the 'dist' folder.
    You can change specification by adapting the build.xml file.
    Of course lot of different possibilities are available for deployment!
    You can find lot of info here:
    [http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm|http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm]
    Important to know is if you want to work with
    - a standalone application (self-contained or not)
    - with webstart
    - or with applets
    (In my case I'm using webstart, but also Self-Contained Application Packaging (jre is also installed!)

  • How can I implement a comfirmation window when closing javafx application?

    hi,guys
    I'd like to add a confirmation window when user is closing my javafx application,if user click yes, I will close the application,if no ,I wouldn't close it ,how can I implement this function?
    primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
                   @Override
                   public void handle(WindowEvent arg0) {
                        try
                             //todo
                        catch(Exception ex)
                             System.out.print(ex.getMessage()+"\r\n");
            });

    Hi. Here is an example:
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Pos;
    import javafx.stage.*;
    import javafx.scene.*;
    import javafx.scene.paint.Color;
    import javafx.scene.layout.*;
    import javafx.scene.control.*;
    public class ModalDialog {
        public ModalDialog(final Stage stg) {
         final Stage stage = new Stage();          
            //Initialize the Stage with type of modal
            stage.initModality(Modality.APPLICATION_MODAL);
            //Set the owner of the Stage
            stage.initOwner(stg);
            Group group =  new Group();
            HBox hb = new HBox();
             hb.setSpacing(20);
            hb.setAlignment(Pos.CENTER);
            Label label = new Label("You are about to close \n your application: ");
            Button no  = new Button("No");
            no.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                       stage.hide();
            Button yes  = new Button("Yes");
            yes.setOnAction(new EventHandler<ActionEvent>() {
                public void handle(ActionEvent event) {
                       stg.close();
             hb.getChildren().addAll(yes, no);
             VBox vb =  new VBox();
             vb.setSpacing(20);
             vb.setAlignment(Pos.CENTER);
             vb.getChildren().addAll(label,hb);
            stage.setTitle("Closing ...");
            stage.setScene(new Scene( vb, 260, 110, Color.LIGHTCYAN));       
            stage.show();
    }Test:
       import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.stage.*;
    * @author Shakir
    public class ModalTest extends Application {
         * @param args the command line arguments
        public static void main(String[] args) {
            Application.launch(ModalTest.class, args);
        @Override
        public void start(final Stage primaryStage) {
            primaryStage.setTitle("Hello World");
            Group root = new Group();
            Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
           primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
                   @Override
                   public void handle(WindowEvent arg0) {
                                    arg0.consume();
                        try
                         ModalDialog md = new ModalDialog(primaryStage);
                        catch(Exception ex)
                             System.out.print(ex.getMessage()+"\r\n");
            primaryStage.setScene(scene);
            primaryStage.show();
    }

  • How to pass Objects from Java App to JavaFX Application

    Hello,
    New to the JavaFX. I have a Java Swing Application. I am trying to use the TreeViewer in JavaFX since it seems to be a bit better to use and less confusing.
    Any help is appreciated.
    Thanks
    I have my Java app calling my treeviewer JavaFX as
    -- Java Application --
    public class EPMFrame extends JFrame {
    Customer _custObj
    private void categoryAction(ActionEvent e)   // method called by Toolbar
            ocsCategoryViewer ocsFX;    //javaFX treeviewer
            ocsFX = new ocsCategoryViewer();    // need to pass in the Customer Object to this Not seeing how to do it.
                                                  // tried ocsFX = new ocsCategoryViewer(_custObj) ;    nothing happened even when set this as a string with a value
    public class ocsCategoryViewer extends Application {
    String _customer;
    @Override
        public void start(Stage primaryStage) {
         TreeView <String> ocsTree;
         TreeItem <String> root , subcat;
      TreeItem <String> root = new TreeItem <String> ("/");
            root.setExpanded(true);
             ocsTree = new TreeView <String> (root);
             buildTree();     // this uses the Customer Object.
            StackPane stkp_root = new StackPane();
            stkp_root.getChildren().add(btn);
            stkp_root.getChildren().add(ocsTree);
            Scene scene = new Scene(stkp_root, 300, 250);
            primaryStage.setTitle("Tree Category Viewer");
            primaryStage.setScene(scene);
            primaryStage.show();
        public static void main(String[] args) {
            _customer = args[0];      // temporarily trying to pass in string.
            launch(args);

    JavaFX and Swing integration is documented by Oracle - make sure you understand that before doing further development.
    What are you really trying to do?  The answer to your question depends on the approach you are taking (which I can't really work out from your question).  You will be doing one of:
    1. Run your Swing application and your JavaFX application as different processes and communicate between them.
    This is the case if you have both a Swing application with a main which you launch (e.g. java MySwingApp) and JavaFX application which extends application which you launch independently (e.g. java MyJavaFXApp).
    You will need to do something like open a client/server network socket between the applications and send the data between them.
    2. Run a Swing application with embedded JavaFX components.
    So you just run java MySwingApp.
    You use a JFXPanel, which is "a component to embed JavaFX content into Swing applications."
    3. Run a Java application with embedded Swing components.
    So you just run java MyJavaFXApp.
    You use a SwingNode, which is "used to embed a Swing content into a JavaFX application".
    My recommendation is:
    a. Don't use approach number one and have separate apps written in Swing and Java - that would be pretty complicated and unwarranted for almost all applications.
    b. Don't mix the two toolkits unless you really need to.  An example of a real need is that you have a huge swing app based upon the NetBeans platform and you want to embed a couple of JavaFX graphs in there.  But if your application is only pretty small (e.g., it took less than a month to write), just choose one toolkit or the other and implement your application entirely in that toolkit.  If your entire application is in Swing and you are just using JavaFX because you think its TreeView is easier to program, don't do that; either learn how to use Swing's tree control and use that or rewrite your entire application in JavaFX.  Reasons for my suggestion are listed here: JavaFX Tip 9: Do Not Mix Swing / JavaFX
    c. If you do need to mix the two toolkits, the answer of which approach to use will be obvious.  If you have a huge Swing app and want to embed one or two JavaFX components in it, then use JFXPanel.  If you have a huge JavaFX app and want to embed one or two Swing components in it, use a SwingNode.  Once you do start mixing the two toolkits be very careful about thread processing, which you are almost certain screw up at least during development, no matter how an experienced a developer you are.  Also sharing the data between the Swing and JavaFX components will be trivial as you are now running everything in the same application within the virtual machine and it is all just Java so you can just pass data around as parameters to constructors and method calls, the same way you usually do in a Java program, you can even use static classes and data references to share data but usually a dependency injection framework is better if you are going to do that - personally I'd just stick to simply passing data through method calls.

  • Exception ... MyClass is not a subclass of javafx.application.Application

    Hi,
    I am creating a Java based Framework, with it proper components that i create based on Java FX, so I know that every Class that uses JavaFx should extends "Application", the problem is that this class already extends from another one to verify the Class Diagram consistency "public class ZCPageDesktop extends ZCAbstractPage", now ZCPageDesktop should also extends "Application" to meet with Java FX specification but Multiple extends are not permitted in Java, So what i did is that i Created a Class Member called "private ZCFXApplication fxapp" which is an instance of the class ZCFXApplication that i created and extends "Application", so i redefined the method public void start(Stage primaryStage){/} then i created also another method to simulate the method public static void draw(String []args){  launch(args) // calling launch } all of this is done in my framework implementation, but when i go to the test , called "UserView" in the main i got this message " Exception in thread "main" java.lang.RuntimeException: Error: class org.zerocouplage.component.test.view.UserView is not a subclass of javafx.application.Application
         at javafx.application.Application.launch(Application.java:211)
         at org.zerocouplage.component.test.view.UserView.main(UserView.java:57)"
    How do i can fix this problem in a way that ZCPageDesktop extends Application, all in respecting the Java FX specification and the non permitted multiple extends ?
    // Test Class
    package org.zerocouplage.component.test.view;
    import static org.zerocouplage.component.common.ZCComponentFactory.newComponent;
    import java.io.IOException;
    import org.zerocouplage.component.api.component.ZCButton;
    import org.zerocouplage.component.api.component.ZCCheckBox;
    import org.zerocouplage.component.api.component.ZCLabel;
    import org.zerocouplage.component.api.component.ZCTextField;
    import org.zerocouplage.component.api.layout.ZCBorderLayout;
    import org.zerocouplage.component.api.page.ZCPage;
    import org.zerocouplage.component.common.exception.ZCCompNotFoundException;
    import org.zerocouplage.component.impl.component.ZCAbstractLabel;
    import com.zerocouplage.api.controller.IZCManager;
    import com.zerocouplage.common.exceptions.ZCExceptionConfig;
    import com.zerocouplage.impl.controller.ZCManagerFactory;
    import org.zerocouplage.component.desktop.page.ZCFXApplication;
    *public class UserView {*
    *     @SuppressWarnings("unused")*
    *     private IZCManager manager;*
    *     public UserView() {*
    *          manager = ZCManagerFactory.getNewManager(this);*
    *     public Object createGui() throws IOException, ZCCompNotFoundException, ZCExceptionConfig {*
    *          ZCPage page = (ZCPage) newComponent(ZCPage.class);*
    *          page.setTitle("Page login");*
    *          ZCBorderLayout layout = (ZCBorderLayout) newComponent(ZCBorderLayout.class);*
    *          ZCAbstractLabel label = (ZCAbstractLabel) newComponent(ZCLabel.class);*
    *          label.setLabel("Nom");*
    *          ZCTextField textField = (ZCTextField) newComponent(ZCTextField.class);*
    *          textField.setText("Text");*
    *          ZCButton button = (ZCButton) newComponent(ZCButton.class);*
    *          button.setText("OK");*
    *          layout.setComponentCenter(button);*
    *          page.setBody(layout);*
    *          return page.display();*
    *     @SuppressWarnings("static-access")*
    *     public static void main(String[] args) {*
    *          UserView userView = new UserView();*
    *          ZCFXApplication Fpage;*
    *          try {*
    *               Fpage=(ZCFXApplication)userView.createGui();*
    *               Fpage.launch(args);*
    *          } catch (IOException | ZCCompNotFoundException | ZCExceptionConfig e) {*
    *               // TODO Auto-generated catch block*
    *               e.printStackTrace();*
    // the implementation of my API the class defining the consistency of the class diagram
    package org.zerocouplage.component.desktop.page;
    import org.zerocouplage.component.impl.page.ZCAbstractPage;
    public class ZCPageDesktop extends ZCAbstractPage {
         * @author Taoufik RIFAI
         private ZCFXApplication fxapp;
         public ZCPageDesktop() throws Exception {
              this.setFxapp(new ZCFXApplication());
         public Object display() {
              fxapp.setTitle(this.getTitle());
              fxapp.setLayout(this.getBody().display());
              return fxapp;
              // seul difference c'est que il faut que dans le test faire
              // f.launch(String[] args) dans le main
         public ZCFXApplication getFxapp() {
              return fxapp;
         public void setFxapp(ZCFXApplication fxapp) {
              this.fxapp = fxapp;
    // the class which extends Application defining the JavaFX specification
    package org.zerocouplage.component.desktop.page;
    import javafx.application.Application;
    import javafx.scene.Group;
    import javafx.scene.Node;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    *public class ZCFXApplication extends Application {*
    *     * @author Taoufik RIFAI*
    *     private String title;*
    *     private Object layout;*
    *     public void start(Stage stage) throws Exception {*
    *          Group group = new Group();*
    *          group.getChildren().add((Node) getLayout());*
    *          System.out.println(getTitle());*
    *          if(getTitle()!=null){*
    *               stage.setTitle(getTitle());*
    *          stage.setScene(new Scene(group, 300, 250));*
    *          stage.show();*
    *     public static void draw(String[] argument) {*
    *          launch(argument);*
    *     public Object getLayout() {*
    *          return layout;*
    *     public void setLayout(Object layout) {*
    *          this.layout = layout;*
    *     public String getTitle() {*
    *          return title;*
    *     public void setTitle(String title) {*
    *          this.title = title;*
    *}*

    I guess you are in the wrong forum. Try JavaFX 2.0 and Later
    Timo

  • Menu Item to exit a JavaFX application

    Hi. I'm very new to JavaFX so please forgive what may be an obvious question.
    Can anyone provide an example of the code to create a menu entry eg File->Exit that will exit a JavaFX app?
    I can create the menus but I don't know how to perform the actual exit.
    Do I use the setOnAction method? What code performs the actual closing of the app?
    Thankyou.
    Tony

    Hi. Here is an example:
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.stage.Stage;
    import javafx.scene.control.*;
    public class MenuIt extends Application {
        public static void main(String[] args) {
            Application.launch(args);
        @Override
        public void start(Stage primaryStage) {
            MenuItem menuItem = new MenuItem("Exit");
            final Menu menu = new Menu("File");
            menu.getItems().add(menuItem);
            MenuBar menuBar = new MenuBar();
            menuBar.getMenus().add(menu);
            menuItem.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent e) {
                    Platform.exit();
            primaryStage.setTitle("Menu sample");
            Group root = new Group();
            Scene scene = new Scene(root, 300, 250);
            root.getChildren().add(menuBar);
            primaryStage.setScene(scene);
            primaryStage.show();
    }

  • Blog post on JavaFX three-tier application (including database)

    Hey guys,
    For anyone interested I have just added a post to my series on Building JEE application with JavaFX. The last two posts have covered client-server remoting over HTTP and database access (using JPA/Hibernate and Spring Data). I know there have been questions asked on these two areas in particular in the past, so I though I would post the link here for reference:
    http://www.zenjava.com/2012/03/19/javafx-and-persistence-adding-database-support/
    If you are looking at building a production grade client-server/database application (the most common type out there these days) you may find this stuff useful.
    Enjoy,
    zonski

    PetShop
    I should mention the company VertigoSoftware that made .NET Pet Shop 4.0;
    https://www.vertigo.com/Lab.aspx has a whitepaper link on their site back to Microsoft http://msdn.microsoft.com/en-us/library/aa479070.aspx#bdasamppet4_topic4.
    I know how to edit web.config and app.config to move the database to another server; Can someone please tell me how to physically separate the "presentation" layer from the "business
    logic + data access" layers i.e. onto different servers? I would like to scale out the web.

  • JNLP-run JavaFX application hangs in full screen on Mac

    Hi all,
    I am on Mac OS X 10.9 running JDK 7u45.
    I have the JNLP file below:
    <?xml version='1.0' encoding='UTF-8'?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/jnlpTester">
    <information>
    <title>Title</title>
    <vendor>Vendor</vendor>
    </information>
    <resources><jfx:javafx-runtime version="2.1+"/></resources>
    <resources><jar href="lib/jnlpTester.jar" main="true"/></resources>
    <application-desc main-class="application.JNLPTester"/>
    <security><all-permissions/></security>
    </jnlp>
    The jar file (jnlpTester.jar) contains the following JavaFX application:
    package application;
    import javafx.application.Application;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.scene.control.ListView;
    import javafx.stage.Stage;
    public class JNLPTester extends Application {
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage primaryStage) throws Exception {
            Parent root = new ListView<>();
            primaryStage.setTitle("Hello World");
            primaryStage.setScene(new Scene(root, 300, 275));
            primaryStage.show();
    The application starts without any problem (see http://tinypic.com/r/29glonq/5). However, when I click on the full screen icon, the application does not go to full screen and the interface hangs (see http://tinypic.com/r/2mwizk/5). When I run the application from my IDE (eclipse) there is no such problem (see http://tinypic.com/r/2gsleep/5).
    Would anyone have any idea about this?
    Many thanks in advance,
    Hayrettin

    No it's simple, but it's not exactly what you are looking for. What I use this for is just to be able to watch a video like an .avi on my tv while surfing the web or writing a document. I hook up the computer to the tv via HDMI and then set the screens up in extended mode(not mirroring) then just drag the VLC window to the TV screen and choose VLCs full screen once the video has started. The problem is it still acts like one monitor so if you do a desktop or full screen swipe on the MBP both screens swipe resulting in the video missing from the TV. So, as I said not excatly what you want, but works to some extent.

  • Is it possible to make a javafx ui application without using layout managers ?

    I want to make an user interface application without using layout managers. In my previous attempt i made an application in java swing. There i used the setBounds() function. Is there any function like setBounds() in javafx ?

    There really isn't any more to it than that.
    Again, I have no idea why you would do things this way (either in JavaFX or in Swing), but:
    import javafx.application.Application;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.Label;
    import javafx.scene.control.TextField;
    import javafx.scene.layout.Pane;
    import javafx.stage.Stage;
    public class ManualPositioningExample extends Application {
        @Override
        public void start(Stage primaryStage) {
            final Pane root = new Pane();
            final Button button = new Button("Click me");
            final Label label = new Label("A Label");
            final TextField textField = new TextField();
            root.getChildren().addAll(button, label, textField);
            label.relocate(25, 25);
            textField.relocate(75, 25);
            textField.setPrefSize(100, 20);
            button.relocate(25, 50);
            button.setPrefSize(150, 20);
            Scene scene = new Scene(root, 400, 200);
            primaryStage.setScene(scene);
            primaryStage.show();
        public static void main(String[] args) {
            launch(args);

Maybe you are looking for

  • Hello evryone, my led of my phone is burning all the time..

    hello evryone, my Led of my phone is burning all the time, verry anoying! what to do? greetz, mijn Led van mijn Iphone blijft de hele tijd branden... wat moet ik doen? garantie? en ben een enorme digibeet.. dus kan iemand een link neerzetten hoe ik h

  • Error in a/c assiginment

    Hi, while doing P.O in ME21n i am getting this error. Account assignment mandatory for material VST1000 (enter acc. ***. cat.) Message no. ME062 Diagnosis There is no provision for value-based inventory management for this material type in this plant

  • Indexed property - editor needed?

    Folks, I have a bean (MyBean) with a indexed property (array of class type ClassX). It has setter and getters (total of 4) according to Java Beans specification. On Netbeans, the indexed property appears on Properties list. But, I can�t add itens to

  • Making a master out of a slide

    I have created a slide and now would like to have it available as a master slide. Is there a way to do this. It was tedious to do to set up all the builds and action and if I can avoid repeating the work, I would love to. Thanks. Carole

  • WHY won't my Photo Stream pictures load to my Dell laptop any longer???

    WHY  won't my Photo Stream pictures load to my Dell laptop any longer???  All  my settings seem to be correct...this is driving me crazy!  Can anyone  HELP?!  This has been going on since Nov. 1st.