Hi All,
I'm very new to this (java(fx) programming) and the last days I'm trying to figure out how I can open the default browser when the user clicks the image (loaded from webpage) in the JFXPanel. This image comes from an openx (ads) server and holds a URL as destination link.
So far all my attempts to accomplish this have failed and I'm lost in this.
Currently when clicking the image, the destination webpage opens in in the same JFXpanel (ofcourse), but I would like to open this in the default browser.
this is what I currently have for initiating the scene from swing
ap = new AdsPanel();
ap.init();
JPanel ad = new JPanel();
ad.add(AdsPanel.fxContainer);
the class for loading the webpage:
//@Override
public void init()
{
fxContainer = new JFXPanel();
fxContainer.setPreferredSize(new Dimension(JFXPANEL_WIDTH_INT, JFXPANEL_HEIGHT_INT));
// create JavaFX scene
Platform.runLater(new Runnable()
{
@Override
public void run()
{
createScene();
}
});
}
private void createScene()
{
Platform.runLater(new Runnable()
{
@Override
public void run()
{
loadURL(FixedVars.SPONSORLINK);
WebView view = new WebView();
webEngine = view.getEngine();
view.setContextMenuEnabled(false);
Scene scene = new Scene(view);
fxContainer.setScene(scene);
}
});
Hope some can help me out.
Thank you very much in advance.