Forex seems to mess up the resources in jar files. Instead off
getting "file://path" they will start with "jfx://" and the program
will crash. I was advised by DK support to update java but
I just tried with 1.6.0_21 and that also does not work. I added some
test content (see below and attachment). The dialog shows properly
when running on the command line with java -jar imagetest.jar but
fails on the platform. I probably do something wrong and I hope you
can tell me what that is.
==============================================================
In the platform:
==============================================================
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import imagetest.Main;
@RequiresFullAccess
@Library("../JForex/Strategies/files/imagetest.jar")
public class ImageTest implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.history = context.getHistory();
this.context = context;
this.indicators = context.getIndicators();
this.userInterface = context.getUserInterface();
Main m = new Main();
}
public void onAccount(IAccount account) throws JFException {
}
public void onMessage(IMessage message) throws JFException {
}
public void onStop() throws JFException {
}
public void onTick(Instrument instrument, ITick tick) throws JFException {
}
public void onBar(Instrument instrument, Period period, IBar
askBar, IBar bidBar) throws JFException {
}
}
==============================================================
And In the jar file:
==============================================================
package imagetest;
import java.awt.BorderLayout;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.io.IOException;
public class Main {
private JFrame frame = new JFrame("Configuration");
private JPanel panel = new JPanel();
public Main()
{
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
BoxLayout mainx = new BoxLayout(panel, BoxLayout.Y_AXIS);
panel.setLayout(mainx);
java.net.URL imageURL = Main.class.getResource("/grey_png.png");
ImageIcon icon = new ImageIcon(imageURL);
JButton addSetup = new JButton("Button Text", icon);
JScrollPane scrollPane = new JScrollPane(panel);
JLabel txt = new JLabel("icon: " + icon + " - imageURL: " + imageURL);
panel.add(addSetup);
panel.add(txt);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) throws IOException {
System.out.println("from main");
Main m = new Main();
}
}