Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

TesterMainGUIMode in JavaFX
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=16&t=56883
Page 1 of 1

Author:  Quantorum [ Sat 05 Jan, 2019, 15:57 ]
Post subject:  TesterMainGUIMode in JavaFX

In JForex SDK, there is TesterMainGUIMode class for visual strategy test, which uses Swing as GUI. I am trying to modify this class so it uses JavaFX instead of Swing.

In order for this to work, JPanel must be inserter into JavaFX. These JPanels are created in the following method of MyTesterWindow class
    
    public void setChartPanels(Map<IChart, ITesterGui> chartPanels) {
        for(Map.Entry<IChart, ITesterGui> entry : chartPanels.entrySet()){
            IChart chart = entry.getKey();
            JPanel chartPanel = entry.getValue().getChartPanel();
            if(chart.getFeedDescriptor().getInstrument().equals(instrument)){
                setTitle(chart.getFeedDescriptor().toString());
                addChartPanel(chartPanel);
                break;
            }
        }
    }


In java8, there is some wrapper for Swing components enabling them to be inserted to JavaFX, but when I modify the method above
   public void setChartPanels(Map<IChart, ITesterGui> chartPanels) {
      for (Entry<IChart, ITesterGui> entry : chartPanels.entrySet()) {
         IChart chart = entry.getKey();
         JPanel chartPanel = entry.getValue().getChartPanel();
         if (chart.getFeedDescriptor().getInstrument().equals(instrument)) {
            SwingNode swingNode = new SwingNode();
            SwingUtilities.invokeLater(() -> swingNode.setContent(chartPanel));
            PaneUtils.insertNodeToContent(swingNode, anchorPane);
            break;
         }
      }
   }


the execution stops on
swingNode.setContent(chartPanel)
.
Has anyone else been trying to use javaFX?

  Page 1 of 1