Announcement

Collapse
No announcement yet.

Use WWJ in my Java FX app

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Use WWJ in my Java FX app

    I'm new to using WWJ. Sorry in advance. I'm trying to add WWJ in my Java FX application. How can i add the same functionality as the ApplicationTemplate.java in my application but using only Java FX. I see that WWJ has been built using Swing tehcnology and all the UI components are Swing, but my current app is using only Java FX. How can i accomplish this? I'd appreciate any help on this. Thanks

  • #2
    Hello
    You have to write something(s) around WorldWindGLJPanel which is compatible with javafx (the component can be added to the scene). You may have a problem with the status bar which remains swing though. Good luck. Also search the forum with javafx, this has been adressed.

    Comment


    • #3
      Thanks Frenchy. I was able to add the window to my application. So how would i go about adding the various components into my java fx application now? Do i do that by implementing the interfaces or just adding the classes into my java fx app. Sorry for the dumb questions but im new to Worldwind. Thanks for any help you can give me to proceed.

      Comment


      • #4
        Hello
        What are the 'various components' you are talking about ? You mean yours or the ones that came along in the past with WWJ (MeasureTool and many others).
        I translated many of these in javaFX, as you may have seen on my profile google photos link (I can't paste it here, moderator?)
        I guess if you want to add your own screens, you'll have to use the 'wwd' and go through the implemented interfaces as you say
        (getModel, addLayer and so on) and implement things as you would have done with swing. Good Luck.

        Comment


        • #5
          Thanks once again Frenchy. I checked out your page and it looks really cool what you have done with WWJ. What i'm trying to do is build an app where i can set a ground station icon on the terrain on the globe and then have an airplane icon that i need to establish a target connection. So what i want to show is the connection between the 2 and have a line between them showing status of the connection( Green - good connection; yellow - not yet connected; red - connection terminated). Then i also want to have some interactivity when the user hovers over the connection line to show statuses like signal quality and other things and also display statuses on the Ground station and airplane icon. Since you were able to implement this using Java FX any help would be much appreciated. Thanks in advance.

          Comment


          • #6
            I seems that WWJ is full of examples that would fit your needs (I have the Earthquakes example in mind but there are many others). Now you'll won't be able to use these classes if you want to use only JavaFX, because this code is made of AWT graphics (but can run called by javaFX). In the callbacks, you'll just have to use Platform.runLater() instead of SwingUtilities.invokeLater(), AFAIR, all the rest is just the same.

            Comment


            • #7
              So for your examples that you created did you rewrite everything into JavaFX components and called Platform.runLater() or did you use all the Swing components and then just added the components to the SwingNode and then add them to JavaFX

              Comment


              • #8
                No, I rewrote only the UI and refactored what could be refactored. Basically I created from any WhateverPanel.java a new WhateverPanelFX.java, that may both use another object say WhateverAction.java, that is common and free of any Swing or FX code. Doing so, I kept the Swing version up and running also. I did not use SwingNode or JFXPanel. I did not use any FXML because I didn't want to create dozens of new files. I'm not sure but using SwingNode would probably lead to thread problems (the events loops are not the same, this is why Platform.runLater() is required)
                Last edited by frenchy; 02-06-2019, 09:54 PM.

                Comment


                • #9
                  For the ApplicationTemplate example, i can't use that since there are Swing components. Sorry for the questions but i'm trying to figure out how i can write this. Are there any Java FX examples that i can check out? I know you have written NASA Worldwind using Java FX. Thanks

                  Comment


                  • #10
                    Please read this thread, among Patrick's jokes, there are serious things in it :-)
                    https://forum.worldwindcentral.com/f...ce-application
                    There is code at the end.

                    Comment


                    • #11
                      Thanks for the thread frenchy..Quite useful and informative it is....Thank you so much DQFanFeedback.com

                      Comment

                      Working...
                      X