0 Replies Latest reply: Feb 22, 2010 1:25 AM by 843849 RSS

    CDC Application with JavaFX

    843849
      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!