Using 3D in JFXPanel

Greetings, I have an issue where a 3D scene isn't rendered properly when embedded in a JFXPanel, not sure of exact terminology, but "depth buffer" / "face culling"? Basically it's like z-ordering isn't being taken into account so sides on the back of cubes are showing through etc. My code works perfectly when embedded as a sub-class of Application. Unfortunately I can't post the code right now as it's at work, and I'm at home.
The issue appears to already have been reported a while ago, but ignored. [http://javafx-jira.kenai.com/browse/RT-17446|http://javafx-jira.kenai.com/browse/RT-17446]
Any body understand what's going on here? Surely just some initialization issue? Any workaround possible? Also is there source code for JavaFX? If so I could debug this issue myself.
Thanks.

Below is my test code that reproduces the problem. It shows 3 rectangles in red, green, blue going "into the page", i.e. with red at front. The mouse can be dragged up and down to rotate the shape.
This renders correctly as native JFX Application but when in a JFXPanel the green and blue rectangles "show through" the red rectangle.
The attribute "embedded" controls if the scene is embedded in a JFXPanel in a JFrame or is "native" JFX Application.
I've reproduced problem on both my work PCs
PC 1: Win XP, with JFX 2.0.1
PC 2: Win 7, with JFX 2.0.2
Screenshots / output when embedded in JFXPanel
http://www.adamish.com/tmp/jfx_depth_buffer_bug/embedded.png
http://www.adamish.com/tmp/jfx_depth_buffer_bug/output_embedded.txt
Screenshots / output when launched as native JFX application
http://www.adamish.com/tmp/jfx_depth_buffer_bug/jfx_native.png
http://www.adamish.com/tmp/jfx_depth_buffer_bug/output_jfx_native.txt
import javafx.application.Application;
import javafx.embed.swing.JFXPanel;
import javafx.event.EventHandler;
import javafx.scene.DepthTest;
import javafx.scene.Group;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.RectangleBuilder;
import javafx.scene.text.Font;
import javafx.scene.text.TextBuilder;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
* Basic example of 3D scene as both JFXPanel in a JFrame and as JFX Application
* sub-class.
public class DepthBufferProblems extends Application {
     final JFXPanel fxPanel = new JFXPanel();
     private final boolean embedded = false;
     private void initAndShowGUI() {
          JFrame frame = new JFrame();
          frame.setSize(300, 300);
          frame.setTitle("Depth Buffer Problems");
          frame.getContentPane().add(fxPanel);
          frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          frame.setVisible(true);
     * Default Constructor
     public DepthBufferProblems() {
          if (embedded) {
               SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                         initAndShowGUI();
     @Override
     public void start(Stage stage) throws Exception {
          if (embedded) {
               fxPanel.setScene(createScene());
          } else {
               stage.setTitle("Depth buffer problems");
               stage.setScene(createScene());
               stage.show();
     private Scene createScene() {
          Color[] colors = new Color[] { Color.RED, Color.GREEN, Color.BLUE };
          final Group shapes = new Group();
          shapes.setDepthTest(DepthTest.ENABLE);
          for (int i = 0; i < colors.length; i++) {
               Color color = colors;
               double z = i * 50;
               shapes.getChildren().add(
                         RectangleBuilder.create().fill(color).width(100)
                                   .height(100).translateZ(z)
                                   .depthTest(DepthTest.ENABLE).build());
               shapes.getChildren().add(
                         TextBuilder.create().text("Foo bar " + i)
                                   .font(Font.font("Arial", 16)).layoutX(20)
                                   .layoutY(40).translateZ(z - 5)
                                   .depthTest(DepthTest.ENABLE).build());
          shapes.setTranslateZ(100); // push back so camera can see everything
          final Group root = new Group();
          root.setDepthTest(DepthTest.ENABLE);
          root.getChildren().add(shapes);
          Scene scene = new Scene(root, 300, 300, true);
          scene.setCamera(new PerspectiveCamera());
          // basic rotate with mouse
          scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
               @Override
               public void handle(MouseEvent event) {
                    shapes.setRotationAxis(Rotate.X_AXIS);
                    shapes.setRotate(event.getSceneY() % 360);
          return scene;
     * Start
     * @param args
     public static void main(String[] args) {
          Application.launch(DepthBufferProblems.class, (String[]) null);
Edited by: 902922 on 19-Dec-2011 01:45

Similar Messages

  • Using DragEvents between different JFXPanels

    Hi. I'm trying to set up a drag-and-drop function in my application that should transfer some data on a successful drag-and-drop completion. I'm following the examples given here:
    Drag-and-Drop Feature in JavaFX Applications | JavaFX 2 Tutorials and Documentation
    The event handler code for my source and target objects are exact copies of the source.setOnDragDetected and target.setOnDragOver / target.setOnDragDropped provided in the above example. I am putting a simple String into the DragBoard with a call to putString on the source event handler.
    The drag and drop is initiated successfully (source event handler fires and puts the text in the DragBoard as per the example), but upon receving the DragEvent in the target event handler, it is not the same DragBoard - this one is simply empty. A call to DragBoard.getString() on the target DragEvent returns null.
    The example works fine, with exactly the same code - line for line. What is different in my application is that both the source and the target nodes exist within separate JFXPanels. I have confirmed that both event handlers fire on the same thread, so it is not a threading issue either.
    I'm drawing a blank here and am starting to think that embedding the scene in a JFXPanel somehow screws up the drag and drop data transfer via DragBoard. Can anybody clarify a bit around this issue for me? Thanks.

    Just running some simple tests, the different JFXPanels do indeed appear to have different dragboards. One workaround is to use a JavaFX Property (or some other mutable wrapper for your data) to store the value being dragged.
    import javafx.application.Platform;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.embed.swing.JFXPanel;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.TextField;
    import javafx.scene.input.ClipboardContent;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.VBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    public class JFXPanelDnD {
        private final StringProperty draggingContent ;
        public JFXPanelDnD() {
            draggingContent = new SimpleStringProperty();
        private void initAndShowGUI() {
            // Execute on EDT thread
            final JFrame frame = new JFrame("DnD Between JFX Panels");
            final JFXPanel leftPanel = new JFXPanel();
            final JFXPanel rightPanel = new JFXPanel();
            final JPanel panel = new JPanel();
            panel.add(leftPanel);
            panel.add(rightPanel);
            frame.add(panel);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(420, 320);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
            Platform.runLater(new Runnable() {
               @Override
               public void run() {
                   configureLeftPanel(leftPanel);
                   configureRightPanel(rightPanel);
        private void configureLeftPanel(JFXPanel panel) {
            // Execute on JavaFX Application thread
            final TextField textField = new TextField();
            final VBox root = new VBox();
            root.setOnDragDetected(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    System.out.println("Drag detected");
                    Dragboard db = root.startDragAndDrop(TransferMode.ANY);
                    System.out.println(db);
                    ClipboardContent content = new ClipboardContent();
                    content.putString(textField.getText());
                    db.setContent(content);
                    draggingContent.set(textField.getText());
                    event.consume();
            root.setOnDragDone(new EventHandler<DragEvent>() {
                @Override
                public void handle(DragEvent event) {
                    draggingContent.set(null);
            root.getChildren().add(textField);
            Scene scene = new Scene(root, 200, 300);
            panel.setScene(scene);
        private void configureRightPanel(JFXPanel panel) {
            final Label label = new Label("Text");
            final VBox root = new VBox();
            root.setOnDragOver(new EventHandler<DragEvent>() {
                @Override
                public void handle(DragEvent event) {
                    final Dragboard dragboard = event.getDragboard();
                    System.out.println(dragboard);
    //                if (dragboard.hasString()) {
    //                    event.acceptTransferModes(TransferMode.COPY);
    //                } else {
    //                    System.out.println("No string content");
                    if (draggingContent.get() != null) {
                        event.acceptTransferModes(TransferMode.COPY);
            root.setOnDragDropped(new EventHandler<DragEvent>(){
                @Override
                public void handle(DragEvent event) {
    //                Dragboard db = event.getDragboard() ;
    //                if (db.hasString()) {
    //                    label.setText(db.getString());
    //                    event.setDropCompleted(true);
    //                } else {
    //                    event.setDropCompleted(false);
                    if (draggingContent.get()==null) {
                        event.setDropCompleted(false);
                    } else {
                        label.setText(draggingContent.get());
                        event.setDropCompleted(true);
                    event.consume();
            root.getChildren().add(label);
            Scene scene = new Scene(root, 200, 300);
            panel.setScene(scene);
        public static void main(String[] args) {
            final JFXPanelDnD test = new JFXPanelDnD();
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    test.initAndShowGUI();

  • Does the lack of Open GL support in Java FX 2 force us to use Swing?

    Hi,
    We are about to start the development of a major User Interface in Java. Naturally, we would prefer to implement this in Java FX 2, rather than Swing. However, we need to render heavy 3D models (generated from several CAD files) with overlay from 3D point clouds with ~400K points. We already have a Swing implementation that supports this, based on the JOGL API. What I have understood, there are no support for JOGL or similar OpenGL wrapper in Java FX 2. Instead, Java FX 2 seems to aim at a high level 3D API. Based on previous attempts to use similar high level API's in the .NET world (e.g. WPF 3D), high level 3D API's are usually not appropriate when working with large and complex 3D models.
    Therefore, I would like to ask for suggestions on what to do here. Do we have to develop our new User Interface in Swing because of this? Or can the announced JavaFX SwingNode be used to wrap such a complex Swing component? If so, how would the performance suffer from the JavaFX wrapping? If the SwingNode doesn't solve the issue and we therefore need to implement the main application in Swing, should we still consider implementing non-3D sub-views with Java FX 2 or should we go for Swing all the way? Our developer group has previous experience from Swing, but none from Java FX. Still, it does not feel right to start the development of a new UI - which we intend to maintain for many years from now - using a deprecated application framework. We are about to decide our way forward here and would really appreciate any thoughts on this topic.
    Thanks,
    Thomas Berglund

    See this StackOverflow question: How to use OpenGL in JavaFX?
    It sounds like the best answer for you is the addition of an OpenGL node to JavaFX.
    An OpenGL node has not yet been added to the JavaFX platform.
    As you have a team of people experienced in 3D development and Java and all of the relevant JavaFX code is open source, I'd encourage you to consider creating an OpenGL node or working with Oracle to create one and (if you are inclined) contributing the development back to the JavaFX code base.  If you are interested in this, contact the openjfx-dev mailing list.
    > Do we have to develop our new User Interface in Swing because of this?
    I don't think so.
    > Or can the announced JavaFX SwingNode be used to wrap such a complex Swing component?
    I don't know, but it doesn't sound quite the right approach to me.
    It seems a dedicated OpenGL rendering node would be a better fit as long as you don't need other Swing functions in your SwingNode.
    > If so, how would the performance suffer from the JavaFX wrapping?
    I think if you had a JavaFX Node which was a Swing Node which handled OpenGL then performance would likely be worse than a JavaFX Node that handled OpenGL directly.
    > If the SwingNode doesn't solve the issue and we therefore need to implement the main application in Swing, should we still consider implementing non-3D sub-views with Java FX 2 or should we go for Swing all the way?
    Either way would work, but I do not recommend mixing the technologies for your application unless you need to.
    There are some considerations with mixing JavaFX and Swing:
    1. Swing widgets look different from JavaFX widgets (and it's not trivial to make them look the same).
    2. You have to learn two toolkits then mentally switch between them when developing (this is just annoying).
    3. You have to be (very) careful of threading issues as each toolkit has it's own primary thread.
    4. There are some bugs in mixing JavaFX and Swing (search JFXPanel in the issue tracker) that simply wouldn't occur if you weren't mixing libraries (most of these bugs have been addressed but some are outstanding).
    5. The Swing functionality isn't going evolve, it's good at what it does, but it is not going to change and get better.
    There is (very experimental) work in merging the JavaFX and Swing application threads, which makes a combined programming model a bit nicer to deal with, but it remains to be seen if that experimental feature becomes a default for both platforms.
    Unless you want to reuse existing extensive Swing libraries (like NetBeans RCP), a pure JavaFX application seems preferred (as long as the OpenGL node can be worked out).
    > Our developer group has previous experience from Swing, but none from Java FX.
    There are similarities, previous knowledge of Swing is a benefit, but there are a lot new things to learn in JavaFX (and a few things to unlearn from Swing likely).
    My 2c . . . best of luck with your project.

  • Application Modal Stage(Window) possible in JFXPanel?

    I'm working on an app using JDK 1.7 (can't move to 8 yet) where the main view code is Swing. In one subapp I am creating a JavaFX Scene which is inside a JFXPanel. I have a JFrame which has a JPanel which has a JFXPanel which has the Scene.
    I am setting up "windows" to allow operations  which are launched off off of right click ContextMenu instances on the scene. I would like these "windows" to be modal over the JFXPanel or even the whole java app if easier.
    So far I have been creating instances of Popup and putting my nodes inside that. I then show the popup over the parent node. This works fine but the popup itself isn't really modal on the scene or app. It does stay open even if the user does other actions on the scene but it also stays open even if the user goes to another subapp which isn't fx and the JFXPanel goes out of focus.
    A couple of problems are that the main app can be moved around and the popup doesn't move with it. Also actions can still be performed on the scene while the Popup is shown. I can stop the actions by in the handlers checking if a popup is open and doing nothing if it is. Also I can hide the popup if the user switches away from the fx subapp by listening on focus events on the JFXPanel.
    Some of the actions launched from within the nodes inside the Popup require confirmation windows to the user. I have been able to get those to work and they do work modally like I expect. They are on top of the Popup window and the user can't do any actions underneath the confirmation window. The confirmation dialogs are implemented by creating a new Stage and setting it's parent to the Popup and setting the modality to Application or Window.
    Since the confirmation window behavior works as I wanted I am trying to make the content nodes of my Popups to behave the same way by putting them in a new Stage and setting the modality to Application or Window. For the parent of the new stage the only thing I can think of is to call getScene().getWindow() on the JFXPanel. This returns a Window instance (EmbeddedWindow I think) and  it seems to work ok with the initOwner() call on the new Stage.
    The new Stage shows up with my contents in it when launched from the right click ContextMenu on the stage. It does seem to be modal as I can't do any operations in the JFXPanel underneath. The problem is that if I do anything in the scene inside the JFXPanel then the 2nd stage goes to the back of focus. I set the 2nd stage to application modal. If I set the 2nd stage to window modal then the other nodes in the scene are not blocked and the 2nd stage isn't modal at all.
    I think I could accomplish what I want if I put another JFXPanel with the Popup contents in it inside of a JDialog every time but I would like to do this with JFX code only if possible.
    I guess the real question is if it's possible to have some kind of truly modal window that stays on top  of a scene inside a JFXPanel using JFX 2. Any ideas that don't involve moving to JFX 8 since that isn't possible for me?
    Thanks,
    -Darryl
    EDIT:
    I see an exception now and maybe this is the real problem. I'm not sure if it was always happening or just started.
    Error: Unsupported type of owner com.sun.javafx.tk.quantum.EmbeddedStage@ce2dc4
    Exception in runnable
    java.lang.ClassCastException: com.sun.javafx.tk.quantum.EmbeddedStage cannot be cast to com.sun.javafx.tk.quantum.WindowStage
      at com.sun.javafx.tk.quantum.WindowStage.setVisible(WindowStage.java:422)
      at javafx.stage.Window$9.invalidated(Window.java:739)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:127)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:161)
      at javafx.stage.Window.setShowing(Window.java:779)
      at javafx.stage.Window.show(Window.java:794)
      at javafx.stage.Stage.show(Stage.java:229)
      at javafx.stage.Stage.showAndWait(Stage.java:395)
    Message was edited by: RDarrylR Added Exception
    Message was edited by: RDarrylR
    Changed title to be more clear

    I changed the title as I think I understand the issue better now. I don't see the exception most of the time but the real question is if I can have an application wide (not just the JavaFx part but the whole outer app) modal stage shown inside a JFXPanel? If I open a Popup inside my JFXPanel on top of the JFXPanel scene then I can have a modal stage with the Popup as the parent. When trying to open a modal stage on top of the scene from the JFXPanel, the modal stage always gets pushed to the back of focus if I click on something outside the JFXPanel.

  • JFXPanel: Attempt to call defer when toolkit not running

    Occaisionally receiving exception -
    java.lang.IllegalStateException: Attempt to call defer when toolkit not running
         at com.sun.javafx.tk.quantum.QuantumToolkit.defer(Unknown Source)
         at com.sun.webpane.sg.prism.InvokerImpl.invokeOnEventThread(Unknown Source)
         at com.sun.webpane.webkit.network.URLLoader.callBack(Unknown Source)
    Using JFXPanel with a WebView under JavaFX 2.1 and Java 1.6.0_29. Application works fine most of the time.
    I believe the problem is that we have to move application panels around inside our application and I believe this is sometimes causing the JavaFX platform to believe it is shutting down when it shouldn't.
    Quote from JavaFX application life-cycle definition -
    "•Waits for the application to finish, which happens either when the last window has been closed, or the application calls Platform.exit()
    So, the question is - is there anyway to control when JavaFX deems "the last window has been closed" ? I'm going to try the dummy application route but thought I would post here in case someone has a better/cleaner way.
    Thanks.

    I get a similar problem with a JFXPanel+WebView inside a ToolWindow of the MyDoggy docking framework (cf http://mydoggy.sourceforge.net/docs/mydoggyset.html)
    Hiding/showing the ToolWindow eventually leads to this exception:
    Exception while removing reference: java.lang.IllegalStateException: Attempt to call defer when toolkit not running
    java.lang.IllegalStateException: Attempt to call defer when toolkit not running
         at com.sun.javafx.tk.quantum.QuantumToolkit.defer(QuantumToolkit.java:618)
         at com.sun.webpane.sg.prism.InvokerImpl.invokeOnEventThread(InvokerImpl.java:40)
         at com.sun.webpane.platform.Disposer$DisposerRunnable.enqueue(Disposer.java:92)
         at com.sun.webpane.platform.Disposer$DisposerRunnable.access$100(Disposer.java:76)
         at com.sun.webpane.platform.Disposer.run(Disposer.java:68)
         at java.lang.Thread.run(Thread.java:680)
    Tested on OS X+JavaFX 2.2b18.
    Should we open a bug for that?
    Edited by: 940268 on 24 juil. 2012 14:53

  • Drag event handling in JFXPanel has performance implications with expensive event handlers

    We have a drag event handler that is a little expensive, takes something like 20ms. The respective code must be run in a synchronous manner however.
    That is no problem in a pure JavaFX environment, as less drag events are created when CPU load is high.
    However, when embedded into Swing using JFXPanel this adaptation doesn't kick in, lots of drag events are created and the application becomes sluggish.
    Is there a way to mimic what JavaFX does in the JFXPanel scenario?
    The code below is a self-contained example that demonstrates what I'm describing.
    Some results I had:
    -eventHandlerSleep=5 -noswing --> 128 drag events
    -eventHandlerSleep=30 -noswing --> 46 drag events
    -eventHandlerSleep=5  --> 136 drag events
    -eventHandlerSleep=30  --> 135 drag events
    {code}import java.util.Arrays;
    import javax.swing.*;
    import com.sun.glass.ui.Robot;
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.embed.swing.JFXPanel;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    public class DragHandlingTester {
        private static long EVENT_HANDLER_SLEEP = 30;
        public static void main(String[] args) {
            for (String arg : args) {
                if (arg.startsWith("-eventHandlerSleep=")) {
                    EVENT_HANDLER_SLEEP = Long.parseLong(arg.split("=")[1]);
            if (Arrays.asList(args).contains("-noswing")) {
                Application.launch(JavaFXDragHandlingTestApp.class, args);
            } else {
                new SwingDragHandlingTestApp();
        static class SwingDragHandlingTestApp {
            SwingDragHandlingTestApp() {
                JFrame frame = new JFrame();
                final JFXPanel fxMainPanel = new JFXPanel();
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        DragTestScene dragTestScene = new DragTestScene();
                        fxMainPanel.setScene(dragTestScene.createScene());
                frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                frame.getContentPane().add(fxMainPanel);
                frame.setSize(800, 600);
                frame.setVisible(true);
        public static class JavaFXDragHandlingTestApp extends Application {
            @Override
            public void start(Stage primaryStage) {
                primaryStage.setWidth(800);
                primaryStage.setHeight(600);
                primaryStage.setX(0.0);
                primaryStage.setY(0.0);
                DragTestScene dragTestScene = new DragTestScene();
                primaryStage.setScene(dragTestScene.createScene());
                primaryStage.show();
        static class DragTestScene {
            private int drags = 0;
            public Scene createScene() {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            // after 1 second drag mouse across window
                            Thread.sleep(1000);
                            Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
                            robot.mouseMove(50, 50);
                            robot.mousePress(1);
                            for (int i = 20; i &lt; 700; i = i + 5) {
                                robot.mouseMove(i, 50);
                                Thread.sleep(10);
                            robot.mouseRelease(1);
                        } catch (Exception e) {
                            e.printStackTrace();
                }).start();
                BorderPane borderPane = new BorderPane();
                borderPane.setOnMouseDragged(new EventHandler() {
                    @Override
                    public void handle(MouseEvent mouseEvent) {
                        drags++;
                        try {
                            Thread.sleep(EVENT_HANDLER_SLEEP);
                        } catch (InterruptedException ignored) {
                        System.out.println("Number of drag events: " + drags);
                return new Scene(borderPane);
    {code}

    Ok, I expected something like this to be the reason. We'll probably have to live with it.
    My workaround right now is to use background tasks with an executor that has a single element queue handling the events in order, but rejecting any additional events as long as there is a queued event.
    Still not the same performance as in JavaFX, but at least it's usable now.

  • GetStylesheets().add("css_file") has no effect for Scene in JFXPanel

    I'm using Netbeans 7 to build a JavaFx application that has a Swing UI with a JFXPanel. No matter what I try, I can't get the scene to use my stylesheet.
    The content of my CSS file is correct. E.g.:
    .my-component {
    -fx-border-color: black;
    -fx-border-width: 2;
    -fx-border-radius: 10;
    -fx-background-color: #CCFF99;
    -fx-background-radius: 10;
    The path to the CSS file is correct. (e.g. "/packagename/mystyle.css"), I've also tried:
    String css = Main.class.getResource("mystyle.css").toExternalForm();
    scene.getStylesheets().add(css);
    My node (a BorderPane) is set to use the CSS class :
    comp2.getStyleClass().add("my-component");
    I've verified the syntax by changing it to one of the built-in classes e.g. "button" and the results are seen in the UI.
    But I can't get anything from my CSS file to work. There are no error messages logged or exceptions thrown. I can fill the CSS file with nonsense errors and it has no effect.. it's like the file isn't being used at all.
    When I use the SAME CSS file in a pure JavaFX application, that is, NOT using JFXPanel, I see a warning if the path to the CSS file is wrong: "WARNING: com.sun.javafx.css.StyleManager$2 run Resource "null" not found."
    When the path is correct in that case, it seems to work fine.
    What could be the problem?

    Moderator advice: Please read the announcement(s) at the top of the forum listings and the FAQ linked from every page. They are there for a purpose.
    Then edit your post and format the code and CSS correctly.
    db

  • Will Scene Builder 2 support SwingNode and JFXPanel?

    We have a large swing app that we're migrating to JavaFX over time. I want to use FXML and SceneBuilder for all new UI design and am wondering if SB 2.0 will support SwingNode and JFXPanel? If so, what level of support? Will I be able to set all the properties/handles in the SwingNode and JFXPanel but nothing inside the embedded node from the other UI type? This is all that I was hoping for.
    We're going be mixing Swing and FX longer term so we'd need this support (along with the custom control support in SB 2.0) to effectively use it.
    Thanks,
    -Darryl

    Sorry for the late reply, Darryl.
    Yes, SB2 will support SwingNode.
    You will be able to drop a SwingNode in any container that accepts a Node:
    - In the Content panel, you will be able to select and move the SwingNode.
    You will not be able to resize it (because a SwingNode has no sizing properties).
    - In the Hierarchy, SwingNode will be a leaf node (SB won't allow you to build
      a Swing UI inside your SwingNode)
    - In the Inspector, SwingNode will be inspectable like any other Node  :
      however SwingNode.content property will not be exposed ; this property will
      have to be manipulated programmatically by your application.
    Eric

  • OnAlert for WebView inside JFXPanel

    I am trying to implement "alert" functionality in a webview that is inside a JFXPanel. Alerts need to be blocking, therefore I need to be able to block inside the onAlert event handler while I display the alert dialog to the user, then proceed after the user clicks OK.
    I am getting either deadlocks or crashes - but haven't found a successful strategy.
    Creating a modal dialog using a Java FX Stage (showAndWait()) causes a crash as soon as the dialog is closed. This is apparently because the top level window is an AWT/Swing window and not a JavaFX window, so it pukes.
    Attempting to create a modal dialog with Swing just deadlocks the system because (I presume) I have to wait inside the event handler for the swing thread to complete, but Swing needs to interact with the JavaFX thread in the mean time, which causes the deadlock.
    Any ideas how I can create a blocking alert box for a WebView inside a JFXPanel?
    -Steve

    Thanks for the reply.
    ArtemAnaniev wrote:
    Could you provide a crash log (hs_err_*.log), when it crashes with JavaFX stage, please?Unfortunately I don't have the error logs anymore.... wasn't able to get it working and just put it on hold. I just tried to set up a small example to reproduce, but now it seems to be working (in my simple example) with showAndWait(). The crash was happening in a more complex example that I don't have handy right now, so it is likely that there were other factors in the deadlocking.
    >
    As for using Swing to implement onAlert() and similar callbacks, it should be possible. You can't just call SwingUtilities.invokeAndWait() as it indeed would lock FX thread. Instead, you need to run a nested FX event loop. Wait... it's not in JavaFX public API, unfortunately :(Ahh.. that will be a very nice feature... I was looking all over for something like it.
    >
    Have you tried Stage.showAndWait()? Is it the method that causes the crash?Yes. That is the method that was crashing. The window would open, but it would crash as soon as I closed it. As I mentioned above, I can't seem to reproduce it right now with my simple example.. Will post here when I am able to reproduce.
    -Steve

  • How to deploy jfxpanel with applet to Tomcat.....

    I want to deploy jfxpanel with in a panel in applet. But a message appear that jfxpanel class not found. when i include the jar file jfxrt.jar, tomcat isn't loaded this file. After that i use the environment varibale and set the class path in javafx runtime lib. but still unable the same exception appeared. I want your help to solve this issue..

    Thank you igor. Your reply resolve most of the issues.. of my application. when i installed javafx runtime alone . the application link http://javafx.com/about-javafx/ that you have given me works fine but it changes the jre or something else... that my own developed application not able to make connection with the tomcat server. when i reinstalled jdk6u29 my application works fine and the link above is not working.
    After that without installing the runtime of javafx 2.0 i install the javafx sdk 2.0.1 the runtime installed by itself. but the same link throws the same exception the exception as after launching my own client application.
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
         at java.lang.Class.getConstructor0(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
         at java.awt.EventQueue.access$000(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: javafx.embed.swing.JFXPanel
         at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
         at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         ... 20 more
    Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/embed/swing/JFXPanel
    After installing the runtime of javafx again the link worked successfully and my client application application didn't able to make connection with tomcat.
    is there any way to merge jre with javafx runtime. and with loading of jre , javafx runtime loaded by itself.????

  • ContextMenu and JFXPanel

    I've tried to add a context menu to the ListView and meet a problem. When my class extends Application everything is Ok, but when I use JFXPanel I don't see context menu. Is it common bug, or only my own? Is there any workaround? Here is my 2 classes
    import javafx.application.Application;
    import javafx.event.*;
    import javafx.scene.*;
    import javafx.scene.control.*;
    import javafx.stage.Stage;
    public class Main3 extends Application { 
      public static void main(String[] args) {
        Application.launch(args);
      public void start(Stage stage) {
        stage.setTitle("Sample");
        stage.setWidth(300);
        stage.setHeight(200);
        Scene scene = createScene();
        stage.setScene(scene);
        stage.show();
      private Scene createScene() {
        ListView<String> listView = new ListView<String>();
        listView.getItems().addAll("1", "2", "3");
        ContextMenu menu = new ContextMenu();
        MenuItem item = new MenuItem("Click me");
        item.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            System.out.println("clicked");
        menu.getItems().add(item);
        listView.setContextMenu(menu);
        Scene scene = new Scene(listView);
        return scene;
    } And with JFXPanel
    import java.awt.BorderLayout;
    import javax.swing.*;
    import javafx.application.Platform;
    import javafx.embed.swing.JFXPanel;
    import javafx.event.*;
    import javafx.scene.*;
    import javafx.scene.control.*;
    public class Main2 {
      public static void main(String[] args) {   
        JPanel panel = new JPanel(new BorderLayout());
        final JFXPanel fxPanel = new JFXPanel();
        panel.add(fxPanel, BorderLayout.CENTER);
        Platform.runLater(new Runnable() {
          public void run() {
            Scene scene = createScene();
            fxPanel.setScene(scene);
        JDialog dialog = new JDialog((java.awt.Frame)null, "Swing");
        dialog.setContentPane(panel);   
        dialog.setSize(300, 200);
        dialog.setLocation(10, 10);
        dialog.setVisible(true);
      public static Scene createScene() {
        ListView<String> listView = new ListView<String>();
        listView.getItems().addAll("1", "2", "3");
        ContextMenu menu = new ContextMenu();
        MenuItem item = new MenuItem("Click me");
        item.setOnAction(new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            System.out.println("clicked");
        menu.getItems().add(item);
        listView.setContextMenu(menu);
        Scene scene = new Scene(listView);
        return scene;
    }

    Well, JavaFX 2.2 beta solved this problem

  • Modality on JFXPanel

    Hi,
    I have a popup which contains a text field and some buttons. Until the user is done with typing in the text field and press ok/cancel the user is not allowed to do
    anything else on the parent window of popup which is JFXPanel. How can I stop all events on JFXPanel.

    Hi Venture,
    It runs fine on my computer with below codes. I dont' know why it's not running in your computer. May be you are using older version of javafx
    My spec:
    Core i5 , Windows 7 (64-bit) with java 1.7.0 (32bit) and javafx 2.0.2 (32bit)
    public class JavaSwingTest extends JFrame{     
         public void buildGUI(){
              final JFXPanel panel = new JFXPanel();          
              Platform.runLater(new Runnable() {
                     public void run() {
                          HBox box = new HBox();
                      Scene sc= new Scene(box);
                      TextField field = new TextField();
                      field.setPromptText("this is prompt");
                      box.getChildren().add(field);          
                      panel.setScene(sc);
              getContentPane().add(panel);          
              setVisible(true);
              setSize(200,200);          
         public static void main(String[] args){
              JavaSwingTest t = new JavaSwingTest();
              t.buildGUI();
    }Thanks
    Narayan

  • How do I use Edge Web Fonts with Muse?

    How do I use Edge Web Fonts with Muse - is it an update to load, a stand alone, how does it interface with Muse? I've updated to CC but have no info on this.

    Hello,
    Is there a reason why you want to use Edge Web Fonts with Adobe Muse?
    Assuming you wish to improve typography of your web pages, you should know that Muse is fully integrated with Typekit. This allows you to access and apply over 500 web fonts from within Muse. Here's how you do it:
    Select a text component within Muse, and click the Text drop-down.
    Select Add Web Fonts option, to pop-open the Add Web Fonts dialog.
    Browse and apply fonts per your design needs.
    Muse also allows you to create paragraph styles that you can save and apply to chunks of text, a la InDesign. Watch this video for more information: http://tv.adobe.com/watch/muse-feature-tour/using-typekit-with-adobe-muse/
    Also take a look at these help files to see if they help you:
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-1.html
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-2.html
    http://helpx.adobe.com/muse/tutorials/typography-muse-part-3.html
    Hope this helps!
    Regards,
    Suhas Yogin

  • How can multiple family members use one account?

    My children have iphones, ipads, ipods and mac books, my problem is how do you use home sharing with the devices and not get each others data.  My Husband just added his iphone to the account and got all of my daughters contacts.  I understand they could have there own accounts but if i buy music on itunes and both children want the same song, I don't feel i should have to pay for it twice.  Is there away we can have home sharing on the devices and they can pick and choose what they want? and is this icloud going to make it harder to keep their devices seperate?

    My children have iphones, ipads, ipods and mac books, my problem is how do you use home sharing with the devices and not get each others data.  My Husband just added his iphone to the account and got all of my daughters contacts.  I understand they could have there own accounts but if i buy music on itunes and both children want the same song, I don't feel i should have to pay for it twice.  Is there away we can have home sharing on the devices and they can pick and choose what they want? and is this icloud going to make it harder to keep their devices seperate?

  • Iphoto crashing after using mini-dvi to video adapter

    Hi, IPhoto on my Macbook is crashing. I can open it, then as soon as I scroll down it locks up and I have to force quit.
    This started happening right after I used a Mini-DVI to Video Adapter cable to hook my macbook up to my TV. The adapter/s-video connection worked and I was able to see the video on the tv. But iphoto immediately locked up the computer when I went to slide show and now it locks every time I open it.
    Any ideas?
    Thank you:)
    Dorothy

    It means that the issue resides in your existing Library.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.
    Regards
    TD

Maybe you are looking for

  • ICal List View

    I used to be able to click on a Calendar and view it in list view but I cannot anymore. I make lots of different calendars and frequently need to delete them. I used to be able to use list view then I could see what appointment i had for the calendar

  • Looking For Method Of Displaying Drill-Down Subreport Data On Same Page

    Not sure what the technical term for this is, but I need to find a way to display dynamic drill-down sub-report data within a report.  Here is an example of what I am trying to accomplish: + DATA SUMMARY 1 + DATA SUMMARY 1 - DATA SUMMARY 1         da

  • Fillable Forms won't save

    Hello!  Pardon my beginner-ness. I've converted a MS Word doc to a fillable form - it went super-smoothly - loved it.  When testing it by sending to another PC, I get a message that indicates, I paraphrase, "data entered into the form won't be saved

  • Apache 2.0.59 - cannot read certificate revocation list

    Hello, i've installed a thawte SSL certificate on a Netware 6.5 SP7 server with apache 2.0.59. If i want to validate the certificate with C1, i get the following error "cannot read certificate revocation list" ! I've found in a forum task, that this

  • 4500HD compiz

    Hi i have an lenovo x200 with an intel 4500 HD graphics card.  i installed compiz and when i enable it windows wont move and it seems like everything is slow.  i can click on the fusion icon and switch back to metacity but it takes a long time becaus