Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

TesterMainGUIMode in JavaFX
 Post subject: TesterMainGUIMode in JavaFX Post rating: 0   New post Posted: Sat 05 Jan, 2019, 15:57 
User avatar

User rating: 0
Joined: Tue 15 Sep, 2015, 20:34
Posts: 2
Location: Czech Republic, Chlumec nad Cidlinou
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?


 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com