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.

Similar Messages

  • CDC Application with Swing

    Hello,
    I am working on a CDC application, with Emulator platform - CDC Java(TM) Platform Micro Edition SDK 3.0, Device - SunVgaAGUIPhone1 and Device Profile - PBP-1.1. The following (Hello World app) works fine for me:
    import java.awt.*;
    public class Main extends Frame {
    public Main () {
    initComponents();
    private void initComponents() {
    pack();
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new Main().setVisible(true);
    public void paint(Graphics g) {
    g.drawString("Hello, World!", 80, 50);
    My understanding is that CDC with AGUI supports swing. However, when I change the above code to the following, it does not work:
    import java.awt.*;
    import javax.swing.*;
    public class Main extends JFrame {
    public Main () {
    initComponents();
    private void initComponents() {
    pack();
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new Main().setVisible(true);
    public void paint(Graphics g) {
    g.drawString("Hello, World!", 80, 50);
    Can anyone tell me what am I missing? Or is this even possible?
    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.

  • JavaFX in a CDC application

    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!

    Hi,
    I want to create a CSV file and email it as an
    attachment to a specified email address once the user
    presses Submit in my application. This is developed
    for Sony Ericsson P990i. Can anyone help me with
    this?
    Thanks in advanceI just tried this yesterday, and got to the point where I realized that the Foundation 1.0 JCL, doesn't support what I need from JavaMail 1.4x. Perhaps the alternative, is to read the RFCs, and write a native client, or maybe FTP the file(s)?
    Jeff

  • I'm having problems with JavaFX applications run on raspberry pi!

    I'm having problems with JavaFX applications run on raspberry pi. I did all the steps of the videos of the course: overclocking, uncommented what I had to uncomment about the framebuffer but Exceptions are still happening. The Fireworks demo example does not work. Someone went through this problem? Java applications are ok. As the versions of java in netbeans project and also on "properties" and they are all JDK 8. So if someone can give a hint, I'm very grateful!

    Can you provide the exceptions you got so I can help you better?
    Would you like to do a coaching session for this?
    -Vinicius

  • How can I select multiple cells in tableview with javafx only by mouse?

    I have an application with a tableview in javafx and i want to select multiple cells only by mouse (something like the selection which exists in excel).I tried with setOnMouseDragged but i cant'n do something because the selection returns only the cell from where the selection started.Can someone help me?

    For mouse drag events to propagate to nodes other than the node in which the drag initiated, you need to activate a "full press-drag-release gesture" by calling startFullDrag(...) on the initial node. (See the Javadocs for MouseEvent and MouseDragEvent for details.) Then you can register for MouseDragEvents on the table cells in order to receive and process those events.
    Here's a simple example: the UI is not supposed to be ideal but it will give you the idea.
    import java.util.Arrays;
    import javafx.application.Application;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.EventHandler;
    import javafx.geometry.Insets;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.SelectionMode;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.input.MouseDragEvent;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.VBox;
    import javafx.scene.text.Font;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class DragSelectionTable extends Application {
        private TableView<Person> table = new TableView<Person>();
        private final ObservableList<Person> data =
            FXCollections.observableArrayList(
                new Person("Jacob", "Smith", "[email protected]"),
                new Person("Isabella", "Johnson", "[email protected]"),
                new Person("Ethan", "Williams", "[email protected]"),
                new Person("Emma", "Jones", "[email protected]"),
                new Person("Michael", "Brown", "[email protected]")
        public static void main(String[] args) {
            launch(args);
        @Override
        public void start(Stage stage) {
            Scene scene = new Scene(new Group());
            stage.setTitle("Table View Sample");
            stage.setWidth(450);
            stage.setHeight(500);
            final Label label = new Label("Address Book");
            label.setFont(new Font("Arial", 20));
            table.setEditable(true);
            TableColumn<Person, String> firstNameCol = new TableColumn<>("First Name");
            firstNameCol.setMinWidth(100);
            firstNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("firstName"));
            TableColumn<Person, String> lastNameCol = new TableColumn<>("Last Name");
            lastNameCol.setMinWidth(100);
            lastNameCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("lastName"));
            TableColumn<Person, String> emailCol = new TableColumn<>("Email");
            emailCol.setMinWidth(200);
            emailCol.setCellValueFactory(
                    new PropertyValueFactory<Person, String>("email"));
            final Callback<TableColumn<Person, String>, TableCell<Person, String>> cellFactory = new DragSelectionCellFactory();
            firstNameCol.setCellFactory(cellFactory);
            lastNameCol.setCellFactory(cellFactory);
            emailCol.setCellFactory(cellFactory);
            table.setItems(data);
            table.getColumns().addAll(Arrays.asList(firstNameCol, lastNameCol, emailCol));
            table.getSelectionModel().setCellSelectionEnabled(true);
            table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
            final VBox vbox = new VBox();
            vbox.setSpacing(5);
            vbox.setPadding(new Insets(10, 0, 0, 10));
            vbox.getChildren().addAll(label, table);
            ((Group) scene.getRoot()).getChildren().addAll(vbox);
            stage.setScene(scene);
            stage.show();
        public static class DragSelectionCell extends TableCell<Person, String> {
            public DragSelectionCell() {
                setOnDragDetected(new EventHandler<MouseEvent>() {
                    @Override
                    public void handle(MouseEvent event) {
                        startFullDrag();
                        getTableColumn().getTableView().getSelectionModel().select(getIndex(), getTableColumn());
                setOnMouseDragEntered(new EventHandler<MouseDragEvent>() {
                    @Override
                    public void handle(MouseDragEvent event) {
                        getTableColumn().getTableView().getSelectionModel().select(getIndex(), getTableColumn());
            @Override
            public void updateItem(String item, boolean empty) {
                super.updateItem(item, empty);
                if (empty) {
                    setText(null);
                } else {
                    setText(item);
        public static class DragSelectionCellFactory implements Callback<TableColumn<Person, String>, TableCell<Person, String>> {
            @Override
            public TableCell<Person, String> call(final TableColumn<Person, String> col) {         
                return new DragSelectionCell();
        public static class Person {
            private final SimpleStringProperty firstName;
            private final SimpleStringProperty lastName;
            private final SimpleStringProperty email;
            private Person(String fName, String lName, String email) {
                this.firstName = new SimpleStringProperty(fName);
                this.lastName = new SimpleStringProperty(lName);
                this.email = new SimpleStringProperty(email);
            public String getFirstName() {
                return firstName.get();
            public void setFirstName(String fName) {
                firstName.set(fName);
            public String getLastName() {
                return lastName.get();
            public void setLastName(String fName) {
                lastName.set(fName);
            public String getEmail() {
                return email.get();
            public void setEmail(String fName) {
                email.set(fName);

  • Drag and Drop objects with JavaFX properties

    Has anyone tried to implement drag and drop functionality with objects containing JavaFX properties? The issue I'm running into is that the objects appear to need to be serializable, and the JavaFX properties are not serializable. I can implement Externalizable instead of Serializable, and basically serialize the values contained by the FX properties, but of course I lose any bindings by doing this (as the listeners underlying the bindings are not serialized).
    The [url http://docs.oracle.com/javafx/2/api/javafx/scene/input/Clipboard.html]javadocs for Clipboard state "In addition to the common or built in types, you may put any arbitrary data onto the clipboard (assuming it is either a reference, or serializable. See more about references later)" but I don't see any further information about references (and at any rate, this doesn't really make sense since anything that's serializable would be a reference anyway). Is there a special DataFormat I can use to specify a reference in the local JVM so the reference gets passed without serialization?
    I know this might not make sense without a code example; I just thought someone might have come across this closely enough to recognize the problem. I'll try to post a code example tonight...

    Here's pretty much the simplest example I can come up with. I have a real-world example of needing to do this, but the object model for the real example is quite a bit more complex.
    For the toy example, imagine we have a list of projects, some employees, and we want to assign each project to one or more employees. I have a Project class with a title and assignee. (In real life you can imagine other properties; due date, status, etc.) I'll keep a ListView with a bunch of unassigned projects (titles but assignees equal to null) and then a ListView for each of the employees.
    To assign a project to an employee, the user should be able to drag from the "master" list view to one of the employee list views. When the project is dropped, we'll create a new project, set the assignee, and bind the title of the new project to the title of the project which was dragged. (Remember we want to be able to assign a single project to multiple employees.)
    So here's the first shot:
    A couple of simple model classes
    Project.java
    import java.io.Externalizable;
    import java.io.IOException;
    import java.io.ObjectInput;
    import java.io.ObjectOutput;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    public class Project {
         private final StringProperty title ;
         private final ObjectProperty<Employee> assignee ;
         public Project(String title) {
              this.title = new SimpleStringProperty(this, "title", title);
              this.assignee = new SimpleObjectProperty<Employee>(this, "assignee");
         public Project() {
              this("");
         public StringProperty titleProperty() {
              return title ;
         public String getTitle() {
              return title.get() ;
         public void setTitle(String title) {
              this.title.set(title);
         public ObjectProperty<Employee> assigneeProperty() {
              return assignee ;
         public Employee getAssignee() {
              return assignee.get();
         public void setAssignee(Employee assignee) {
              this.assignee.set(assignee);
         @Override
         public String toString() {
              String t = title.get();
              Employee emp = assignee.get();
              if (emp==null) {
                   return t;
              } else {
                   return String.format("%s (%s)", t, emp.getName()) ;
    }Employee.java
    import java.io.Externalizable;
    import java.io.IOException;
    import java.io.ObjectInput;
    import java.io.ObjectOutput;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    public class Employee {
         private StringProperty name ;
         public Employee(String name) {
              this.name = new SimpleStringProperty(this,"name", name);
         public StringProperty nameProperty() {
              return name ;
         public String getName() {
              return name.get();
         public void setName(String name) {
              this.name.set(name);
    }and the application
    DnDExample.java
    import javafx.application.Application;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.ObservableList;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.ListCell;
    import javafx.scene.control.ListView;
    import javafx.scene.control.TextField;
    import javafx.scene.input.ClipboardContent;
    import javafx.scene.input.DataFormat;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.HBox;
    import javafx.scene.layout.VBox;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class DnDExample extends Application {
         private static final DataFormat PROJECT_DATA_FORMAT = new DataFormat("com.example.project"); // is there something special I can use here?
         @Override
         public void start(Stage primaryStage) {
              final HBox root = new HBox(5);
              final ListView<Project> allProjects = new ListView<Project>();
              final Employee fred = new Employee("Fred");
              final Employee ginger = new Employee("Ginger");
              final ListView<Project> fredsProjects = new ListView<Project>();
              final ListView<Project> gingersProjects = new ListView<Project>();
              final VBox employeeLists = new VBox(5);
              employeeLists.getChildren().addAll(new Label("Fred's Projects"), fredsProjects, new Label("Ginger's Projects"), gingersProjects);
              root.getChildren().addAll(allProjects, employeeLists);
              allProjects.setCellFactory(new Callback<ListView<Project>, ListCell<Project>>() {
                   @Override
                   public ListCell<Project> call(ListView<Project> listView) {
                        return new AllProjectListCell();
              allProjects.setEditable(true);
              final EventHandler<DragEvent> dragOverHandler = new EventHandler<DragEvent>() {
                   @Override
                   public void handle(DragEvent dragEvent) {
                        if (dragEvent.getDragboard().hasContent(PROJECT_DATA_FORMAT)) {
                             dragEvent.acceptTransferModes(TransferMode.COPY);
              fredsProjects.setOnDragOver(dragOverHandler);
              gingersProjects.setOnDragOver(dragOverHandler);
              fredsProjects.setOnDragDropped(new DragDropHandler(fred, fredsProjects.getItems()));
              gingersProjects.setOnDragDropped(new DragDropHandler(ginger, gingersProjects.getItems()));
              allProjects.getItems().addAll(new Project("Implement Drag and Drop"), new Project("Fix serialization problem"));
              Scene scene = new Scene(root, 600, 400);
              primaryStage.setScene(scene);
              primaryStage.show();
         public static void main(String[] args) {
              launch(args);
         private class DragDropHandler implements EventHandler<DragEvent> {
              private final Employee employee ;
              private final ObservableList<Project> itemList;
              DragDropHandler(Employee employee, ObservableList<Project> itemList) {
                   this.employee = employee ;
                   this.itemList = itemList ;
              @Override
              public void handle(DragEvent event) {
                   Dragboard db = event.getDragboard();
                   if (db.hasContent(PROJECT_DATA_FORMAT)) {
                        Project project = (Project) db.getContent(PROJECT_DATA_FORMAT);
                        Project assignedProject = new Project();
                        assignedProject.titleProperty().bind(project.titleProperty());
                        assignedProject.setAssignee(employee);
                        itemList.add(assignedProject);
         private class AllProjectListCell extends ListCell<Project> {
              private TextField textField ;
              private final EventHandler<MouseEvent> dragDetectedHandler ;
              AllProjectListCell() {               
                   this.dragDetectedHandler = new EventHandler<MouseEvent>() {
                        @Override
                        public void handle(MouseEvent event) {
                             Dragboard db = startDragAndDrop(TransferMode.COPY);
                             ClipboardContent cc = new ClipboardContent();
                             cc.put(PROJECT_DATA_FORMAT, getItem());
                             db.setContent(cc);
                             event.consume();
                   this.setEditable(true);
              @Override
              public void updateItem(final Project project, boolean empty) {
                   super.updateItem(project, empty);
                   if (empty) {
                        setText(null);
                        setGraphic(null);
                        setOnDragDetected(null);
                   } else if (isEditing()) {
                        if (textField != null) {
                             textField.setText(getItem().getTitle());
                        setText(null) ;
                        setOnDragDetected(null);
                        setGraphic(textField);                    
                   } else {
                        setText(project.getTitle());
                        setOnDragDetected(dragDetectedHandler);
              @Override
              public void startEdit() {
                   super.startEdit();
                   if (!isEmpty()) {
                        textField = new TextField(getItem().getTitle());
                        textField.setMinWidth(this.getWidth()-this.getGraphicTextGap());
                        textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
                             @Override
                             public void changed(
                                       ObservableValue<? extends Boolean> observable,
                                       Boolean oldValue, Boolean newValue) {
                                  if (! newValue) {
                                       getItem().setTitle(textField.getText());
                                       commitEdit(getItem());
                        setText(null);
                        setGraphic(textField);
                        setOnDragDetected(null);
              @Override
              public void cancelEdit() {
                   super.cancelEdit();
                   if (!isEmpty()) {
                        setText(getItem().getTitle());
                        setGraphic(null);
                        setOnDragDetected(dragDetectedHandler);
                   } else {
                        setText(null);
                        setGraphic(null);
                        setOnDragDetected(null);
              @Override
              public void commitEdit(Project project) {
                   super.commitEdit(project);
                   if (!isEmpty()) {
                        setText(getItem().getTitle());
                        setGraphic(null);
                        setOnDragDetected(dragDetectedHandler);
    }If you try to drag from the list on the left to one of the lists on the right, it will fail pretty quickly and tell you that the data need to be Serializable.
    Simply adding "implements Serializable" to the Project and Employee classes doesn't work, as you find that SimpleStringProperty and SimpleObjectProperty are not Serializable. So instead I can use Externalizable:
    public class Project implements Externalizable {
    @Override
         public void writeExternal(ObjectOutput out) throws IOException {
              out.writeObject(title.get());
              out.writeObject(assignee.get());
         @Override
         public void readExternal(ObjectInput in) throws IOException,
                   ClassNotFoundException {
              setTitle((String)in.readObject());
              setAssignee((Employee)in.readObject());
    }and
    public class Employee implements Externalizable {
         @Override
         public void writeExternal(ObjectOutput out) throws IOException {
              out.writeObject(name.get());
         @Override
         public void readExternal(ObjectInput in) throws IOException,
                   ClassNotFoundException {
              setName((String) in.readObject());
    }This makes the drag and drop work, but if you drop a project on one of the employee lists, then edit the project title in the master list, the binding is not respected. This is because deserialization creates a new SimpleStringProperty for the title, which is not the property to which the title of the new Project object is bound.
    What I really want to do is to be able to drag and drop an object within the same JVM simply by passing the object by reference, rather than by serializing it. Is there a way to do this? Is there some DataFormat type I need?

  • Submiting HTML Forms with JavaFX Webview

    I've long been searching for a good web robot framework. And I also need a gui for my robot.
    So w/ the advent of JAVAFX Webengine it seemed my needs have been met finally. Specially because on the webview tutorial here , Alla Redko says: "+It supports user interaction such as navigating links *and submitting HTML forms*+".
    But after looking at the api it doesn't seem that webengine supports submiting forms, only loading pages w/ the load() method. I guess I could populate the form fields and submit them w/ executeScript() but that's just sloppy.
    Is there a way to actually submit forms w/ webengine? Are there plans to implement this feature, analogous to the load() method?
    Thanks,
    JC

    Yea, as I mentioned in the first post, I could do all that w/ JS but it's just sloppy, since I'm using Java language, not JS.
    The finding certain fields part is easy w/ the Document model and xpath, it's the populating the fields and submiting the form along w/ its hidden input fields that is the missing part.
    Does anyone know if these things are planned for the future of Webview/Webengine?You can already do this in Java today using the existing APIs if you so wished.
    import javafx.application.Application;
    import javafx.beans.property.*;
    import javafx.beans.value.*;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.*;
    import javafx.scene.layout.*;
    import javafx.scene.web.*;
    import javafx.stage.Stage;
    import org.w3c.dom.*;
    import org.w3c.dom.html.*;
    public class WebViewFormPost extends Application {
      public static void main(String[] args) { launch(args); }
      @Override public void start(Stage stage) {
        final TextField fxUsername = new TextField();
        final TextField fxPassword = new PasswordField();
        final BooleanProperty loginAttempted = new SimpleBooleanProperty(false);
        final WebView webView = new WebView();
        final WebEngine engine = webView.getEngine();
        engine.documentProperty().addListener(new ChangeListener<Document>() {
          @Override public void changed(ObservableValue<? extends Document> ov, Document oldDoc, Document doc) {
            if (doc != null && !loginAttempted.get()) {
              if (doc.getElementsByTagName("form").getLength() > 0) {
                HTMLFormElement form = (HTMLFormElement) doc.getElementsByTagName("form").item(0);
                if ("/oam/server/sso/auth_cred_submit".equals(form.getAttribute("action"))) {
                  HTMLInputElement username = null;
                  HTMLInputElement password = null;
                  NodeList nodes = form.getElementsByTagName("input");
                  for (int i = 0; i < nodes.getLength(); i++) {
                    HTMLInputElement input = (HTMLInputElement) nodes.item(i);
                    switch (input.getName()) {
                      case "ssousername":
                        username = input;
                        break;
                      case "password":
                        password = input;
                        break;
                  if (username != null && password != null) {
                    loginAttempted.set(true);
                    username.setValue(fxUsername.getText());
                    password.setValue(fxPassword.getText());
                    form.submit();
                    System.out.println("Submitted login for user: " + username);
        engine.getLoadWorker().exceptionProperty().addListener(new ChangeListener<Throwable>() {
          @Override public void changed(ObservableValue<? extends Throwable> ov, Throwable oldException, Throwable exception) {
            System.out.println("Load Exception: " + exception);
        GridPane inputGrid = new GridPane();
        inputGrid.setHgap(10);
        inputGrid.setVgap(10);
        inputGrid.addRow(0, new Label("Username: "), fxUsername);
        inputGrid.addRow(0, new Label("Password: "), fxPassword);
        Button fxLoginButton = new Button("Login to Oracle Forums");
        fxLoginButton.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent t) {
            if (notEmpty(fxPassword.getText()) && notEmpty(fxPassword.getText())) {
              loginAttempted.set(false);
              engine.load("https://forums.oracle.com/forums/login!withRedirect.jspa");
        final VBox layout = new VBox(10);
        layout.setStyle("-fx-background-color: cornsilk; -fx-padding: 10;");
        layout.getChildren().addAll(
          new Label("Enter your Oracle Web Account credentials"),
          inputGrid,
          fxLoginButton,
          webView
        stage.setScene(new Scene(layout));
        stage.show();
      private boolean notEmpty(String s) {
        return s != null && !"".equals(s);
    }Personally, I think using JavaScript via engine.executeScript calls in combination with jquery might be a less messy solution (as I don't like writing against the raw dom apis), but I understand that there are valid reasons why you might prefer to use a Java only solution.
    https://gist.github.com/jewelsea/3077942 "Embeds jQuery in a document loaded into a WebView."

  • Starting with JavaFX 2.0 - Any doubts

    I'm starting with JAvaFX 2.0.
    I need to make a application, but a have any doubts.
    - Whats the better, make layouts (Forms) in FXML or JAva Code ? Because, i read any developers prefers use Java Code, to make complex layouts (forms);
    - JavaFX has a Date component ? I have not found it.
    Thanks
    Thiago

    Hi!
    1. I would recommend FXML, because it's much faster to operate with (thanks to Scene Builder -> http://www.oracle.com/technetwork/java/javafx/tools/index.html). Try to check this after you install Scene Builder: http://docs.oracle.com/javafx/scenebuilder/1/overview/jsbpub-overview.htm
    Moreover, by using FXML you split the GUI code and the logic code, making them much easier to maintain and test.
    2. There's no date component in the official JFX 2, but take a look here: http://jfxtras.org/
    Cheers!
    Edited by: zmirc on Jan 19, 2013 11:43 AM
    I forgot a link.

  • Playing videos with JavaFX

    Hello,
    I'm trying to add a new functionality to an existent Java application which allows playing local videos.
    First I tried with JMF but I have read in the next web that it's better to do this with JavaFX.
    [http://javatrack.blogspot.com/2009/08/video-in-java-no-more-jmf-please-use.html|http://javatrack.blogspot.com/2009/08/video-in-java-no-more-jmf-please-use.html]
    I want to do this if it's easier than JMF but I was not able to call a JavaFX script from mi Java code.
    Anybody knows if this is posible and relatively easy?
    Thank you very much!

    Have you tried getting info on an affected file (click on a movie file and click Command-I on the keyboard) and then changing the application to open that file type in the Info window? (In the "Open with" section, select Quicktime - navigate to the Quicktime application on your hard drive if necessary.)
    That's the standard Mac method to set what app opens any particular file type (e.g. HTML, PDF, MP3, etc.)
    If the file is on your hard drive rather than a CD, the procedure is to do the above, then click on "Change All" if you want all files of that type to be opened with that application from then on. If it's on a CD, it doesn't allow that, which is fine in this case - it asks if you want to open all files of that type with Quicktime. In that case, click on Continue and you should be all set.
    Do this for each file type (.avi, .mov, and so on) that you want to open with Quicktime. It should stick for all files of that type after you've done this with one file of that type.
    15" MacBook Pro 2.0GHz/100GB (7200rpm)/2GB RAM; Windows XP Pro on Parallels   Mac OS X (10.4.7)   400MHz G4 (Sawtooth); Airport network; 60GB iPod photo; Dell-in-the-Closet

  • How to escape bluecove preverify error on mobile with javaFX?

    Hi all, I'm finding a problem with an application that runs for a standard execution but not on mobile emulator. I am having the following error at execution.
    Error preverifying class com.intel.bluetooth.btgoep.Connection
    java/lang/NoClassDefFoundError: com/ibm/oti/connection/CreateConnection
    ERROR: preverify execution failed, exit code: 1
    I don't know how to go through. I'm using netbeans with javaFx plugins and the application seems to be working with standard execution but not on the mobile emulmator.
    Should anyone have an idea of what is happening here I'll be strongly interested.. Thanks for help.

    The PC10 in vlan 10 can not ping the gateway (10.64.16.1) of vlan 20. It can only ping its own gateway 10.64.8.1
    Both hosts are running Windows 7 professional with firewall turned off.
    The same for the PC20 in vlan 20. It can only ping its own gateway (10.64.16.1) but not vlan10's gateway (10.64.8.1)
    In fact, just for testing purposes.
    I temporarily assign g0/1/2 (which was on vlan20) to vlan10 now. Changed the host (PC20) IP to 10.64.8.3.
    After this change, the 2 hosts can ping each other (in the same vlan 10)....that's expected. So, the OSes and firewalls issues on the hosts are not the issue. They can ping each other when they are in the same vlan.
    However, now that they are in the same vlan, they still can't ping out to G0/0 192.168.0.162.
    So, the problem is how to ping from the layer 2 EHWIC to the built-in G0/0 and G0/1 router ports?

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

  • Access Network Camera with JavaFX is possible?

    hi,
    i have IP Camera Foscam 8910W and it have the access via http for see mpeg movie via network
    if i access in firefox http://myipcamera/videostream.asf?user=xx&pwd=yy
    i see the direct movie of this network camera
    i have create a application swing+javafx for show this movie in JFrame
    is possible use this with JavaFX?
    Dario

    Actually i am having java code for camera applications.and i want to use it for the javafx applications.But for displaying camera control in javame we will typecast it as below.
    (Item)videoControl. initDisplayMode(VideoControl.USE_GUI_PRIMITIVE, null)
    and append it to a form.
    But for javafx we want node so that it is displayed.But how i acheive this thing in javafx.

  • Commercial multiplatform product for desktop with JavaFx technology

    Is there a commercial multiplatform desktop application based on JavaFx technology with Standard Execution model?

    Because I'm happy with Flex for my RIA front-ends, I have not spent much time on JavaFX. However, I do believe your understanding of its state is largely correct. If you haven't done so already, you may want to check out the JavaFX FAQ. You may also want to check out the [OpenJFX java.net forum|http://forums.java.net/jive/category.jspa?categoryID=62] and possibly pose your questions there.
    My understanding is that JavaFX Desktop and Java SE [JRE Consumer Edition|http://www.theregister.co.uk/2007/05/09/sun_java_se_glassfish/] are [two separate things|http://blogs.sun.com/sfehrman/entry/javaone_day_one], but with JavaFX Desktop depending on Java SE 6 Update 10/Consumer Edition. [Java SE 6 Update 10|http://java.sun.com/developer/technicalArticles/javase/java6u10/index.html], [formerly known as Java SE 6 Update N|http://weblogs.java.net/blog/chet/archive/2007/10/early_access_gr.html], is the the [consumer edition|https://jdk6.dev.java.net/6u10ea.html] and was-so named because it was designed to optimize user experience with the JRE.

  • How to start a application with a login window?

    hi there
    does anyone have any idea on how to start an application with a login window? a login window is the first frame or window to be displayed when an application starts running. and only correct login id and password have been entered the real application will start. any sample out there? thank you.

    You can start a new thread by making a thread object and passing it an implementation of a runnable object. Runnable has just one method, public void run(), this is was gets executed in a second thread. perhaps the code you would use would look something like this.
    <code>
    // set up thread for login window
    new Thread(new Runnable() {
    public void run() {
    // construct your login window here
    // when you are done processing the
    // password....
    if(goodPassword) {
    authorized = true; // a global variable
    notifyAll(); // don't forget this
    else {
    System.exit(42);
    }).start();
    // control does not stop this code gets executed while
    // the above thread is running.
    // Set up main program here. This is done in the
    // backround.
    while(!authorized) {
    synchronized(this)
    { wait(50); }
    // now when the user logs in this frame pops
    // up real quick.
    myFrame.setVisible(true);
    </code>
    Hope you can figure it out.. good luck :)

  • How to launch an application with elevated administrator account privilege from windows service even if the account has not yet logon

    Here is the case:
    OS environment: Windows 7
    There are two user accounts in my system, standard user "S" and administrator account "A", and there is a windows service running with "Local System" privilege.
    Now i logged-in with account "S", and i want to launch an application with elevated administrator account "A" from that service program, so here is the code snippet:
    int LaunchAppWithElevatedPrivilege (
    LPTSTR lpszUsername, // client to log on
    LPTSTR lpszDomain, // domain of client's account
    LPTSTR lpszPassword, // client's password
    LPTSTR lpCommandLine // command line to execute e.g. L"C:\\windows\\regedit.exe"
    DWORD dwExitCode = 0;
    HANDLE hToken = NULL;
    HANDLE hFullToken = NULL;
    HANDLE hPrimaryFullToken = NULL;
    HANDLE lsa = NULL;
    BOOL bResult = FALSE;
    LUID luid;
    MSV1_0_INTERACTIVE_PROFILE* profile = NULL;
    DWORD err;
    PTOKEN_GROUPS LocalGroups = NULL;
    DWORD dwLength = 0;
    DWORD dwSessionId = 0;
    LPVOID pEnv = NULL;
    DWORD dwCreationFlags = 0;
    PROCESS_INFORMATION pi = {0};
    STARTUPINFO si = {0};
    __try
    if (!LogonUser( lpszUsername,
    lpszDomain,
    lpszPassword,
    LOGON32_LOGON_INTERACTIVE,
    LOGON32_PROVIDER_DEFAULT,
    &hToken))
    LOG_FAILED(L"GetTokenInformation failed!");
    __leave;
    if( !GetTokenInformation(hToken, (TOKEN_INFORMATION_CLASS)19, (VOID*)&hFullToken,
    sizeof(HANDLE), &dwLength))
    LOG_FAILED(L"GetTokenInformation failed!");
    __leave;
    if(!DuplicateTokenEx(hFullToken, MAXIMUM_ALLOWED, NULL,
    SecurityIdentification, TokenPrimary, &hPrimaryFullToken))
    LOG_FAILED(L"DuplicateTokenEx failed!");
    __leave;
    DWORD dwSessionId = 0;
    WTS_SESSION_INFO* sessionInfo = NULL;
    DWORD ndSessionInfoCount;
    bResult = WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, &sessionInfo, &ndSessionInfoCount);
    if (!bResult)
    dwSessionId = WTSGetActiveConsoleSessionId();
    else
    for(unsigned int i=0; i<ndSessionInfoCount; i++)
    if( sessionInfo[i].State == WTSActive )
    dwSessionId = sessionInfo[i].SessionId;
    if(0 == dwSessionId)
    LOG_FAILED(L"Get active session id failed!");
    __leave;
    if(!SetTokenInformation(hPrimaryFullToken, TokenSessionId, &dwSessionId, sizeof(DWORD)))
    LOG_FAILED(L"SetTokenInformation failed!");
    __leave;
    if(CreateEnvironmentBlock(&pEnv, hPrimaryFullToken, FALSE))
    dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
    else
    pEnv=NULL;
    if (! ImpersonateLoggedOnUser(hPrimaryFullToken) )
    LOG_FAILED(L"ImpersonateLoggedOnUser failed!");
    __leave;
    si.cb= sizeof(STARTUPINFO);
    si.lpDesktop = L"winsta0\\default";
    bResult = CreateProcessAsUser(
    hPrimaryFullToken, // client's access token
    NULL, // file to execute
    lpCommandLine, // command line
    NULL, // pointer to process SECURITY_ATTRIBUTES
    NULL, // pointer to thread SECURITY_ATTRIBUTES
    FALSE, // handles are not inheritable
    dwCreationFlags, // creation flags
    pEnv, // pointer to new environment block
    NULL, // name of current directory
    &si, // pointer to STARTUPINFO structure
    &pi // receives information about new process
    RevertToSelf();
    if (bResult && pi.hProcess != INVALID_HANDLE_VALUE)
    WaitForSingleObject(pi.hProcess, INFINITE);
    GetExitCodeProcess(pi.hProcess, &dwExitCode);
    else
    LOG_FAILED(L"CreateProcessAsUser failed!");
    __finally
    if (pi.hProcess != INVALID_HANDLE_VALUE)
    CloseHandle(pi.hProcess);
    if (pi.hThread != INVALID_HANDLE_VALUE)
    CloseHandle(pi.hThread);
    if(LocalGroups)
    LocalFree(LocalGroups);
    if(pEnv)
    DestroyEnvironmentBlock(pEnv);
    if(hToken)
    CloseHandle(hToken);
    if(hFullToken)
    CloseHandle(hFullToken);
    if(hPrimaryFullToken)
    CloseHandle(hPrimaryFullToken);
    return dwExitCode;
    I passed in username and password of account "A" to method "LaunchAppWithElevatedPrivilege", and also the application i want to launch, e.g. "C:\windows\regedit.exe", but when i run the service program, i found it do launch
    "regedit.exe" with elevated account "A", but the content of regedit.exe is pure back. screenshot as below:
    Can anyone help me on this?

    You code is not dealing with the DACL access to Winsta0\Default.  Only the LocalSystem account will have full access and the interactively logged on user which is why regedit is not displaying properly.  You'll need to grant access to your user. 
    You also need to deal with UAC since that code is going to give you a non-elevated token via LogonUser().  You need to get the full token via a call to GetTokenInformation() + TokenLinkedToken.
    thanks
    Frank K [MSFT]
    Follow us on Twitter, www.twitter.com/WindowsSDK.

Maybe you are looking for

  • How can I Send a fax directly with HP Officejet Pro 8500

    Hello I have a printer of the type hp officejet 7100 series When I want to send a fax directly, a text document, for example, type it on the printer hp officejet 7100 series fax And converts it to a fax machine directly. Now I buy a new printer HP Of

  • Syncing New Music from my New Mac Book Pro to my iPhone

    I just bought a new Mac Book Pro and have already started getting new music on it. I want to replace the old music on my iPhone with the new music on my Mac Book but everytime I sync it, it doesn't work. How can I replace the old music on my iPhone w

  • My compaq presario f700 wont't power on

    my laptop won't power on but is charging. i have checked the power buttton but is not from there.

  • Commands redrawing (Samsung)

    I'm developing for SGH Samsung S100 and find that if I switch from Form with Command objects on it to Canvas (which has no Command objects), the Command objects from the Form remain at the bottom of the screen and are not cleared. They remain even If

  • Close portal window ( popup ) through an button event within the wd-app

    Hello Experts, the scenario is as follows: i click on a link within the enterprise portal environment and it opens a wd application within a popup( portal window ). This application has a CANCEL button. when a user clicks on this the portal window sh