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?