Dukascopy
 
 
Wiki JStore Search Login

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

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

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

embedding browser in jforex
 Post subject: embedding browser in jforex Post rating: 0   New post Posted: Fri 08 Nov, 2013, 11:49 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
Hi,

i was looking into embedding a browser into the app (for the news)

i found this solution https://djproject.sourceforge.net/ns/

/*
 * Christopher Deckers ([email protected])
 * https://www.nextencia.net
 *
 * See the file "readme.txt" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 */
package chrriis.dj.nativeswing.swtimpl.demo.examples.webbrowser;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import chrriis.common.UIUtils;
import chrriis.dj.nativeswing.swtimpl.NativeInterface;
import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;

/**
 * @author Christopher Deckers
 */
public class SimpleWebBrowserExample extends JPanel {

  public SimpleWebBrowserExample() {
    super(new BorderLayout());
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("Native Web Browser component"));
    final JWebBrowser webBrowser = new JWebBrowser();
    webBrowser.navigate("https://www.google.com");
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    add(webBrowserPanel, BorderLayout.CENTER);
    // Create an additional bar allowing to show/hide the menu bar of the web browser.
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
    JCheckBox menuBarCheckBox = new JCheckBox("Menu Bar", webBrowser.isMenuBarVisible());
    menuBarCheckBox.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent e) {
        webBrowser.setMenuBarVisible(e.getStateChange() == ItemEvent.SELECTED);
      }
    });
    buttonPanel.add(menuBarCheckBox);
    add(buttonPanel, BorderLayout.SOUTH);
  }

  /* Standard main method to try that test as a standalone application. */
  public static void main(String[] args) {
    UIUtils.setPreferredLookAndFeel();
    NativeInterface.open();
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        JFrame frame = new JFrame("DJ Native Swing Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new SimpleWebBrowserExample(), BorderLayout.CENTER);
        frame.setSize(800, 600);
        frame.setLocationByPlatform(true);
        frame.setVisible(true);
      }
    });
    NativeInterface.runEventPump();
  }

}


i was about to write a strategy to request a webpage from within jforex using that java browser but i'm wondering, not if it'll work, but in case it works, would there be any security issue to think at (it 'd be mainly for calendars - some using sockets to push the data)?


 
 Post subject: Re: embedding browser in jforex Post rating: 0   New post Posted: Fri 08 Nov, 2013, 11:59 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
in fact this https://docs.oracle.com/javafx/2/webview ... ebview.htm seems the way to go, however the question remains, thanks in advance


 
 Post subject: Re: embedding browser in jforex Post rating: 1   New post Posted: Fri 08 Nov, 2013, 12:49 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Before reinventing the wheel, are you aware of News->Live Economic Calendar?
I know it is not perfect, but maybe good enough for your needs...


 
 Post subject: Re: embedding browser in jforex Post rating: 0   New post Posted: Fri 08 Nov, 2013, 13:29 
User avatar

User rating: 0
Joined: Sun 04 Aug, 2013, 10:16
Posts: 48
Location: FranceFrance
i thought i was but you compelled me to look again,

& indeed i had just tried the first "economic calendar" of the menu which opens a browser tab, now i just discovered the second economic calendar option which opens a tab in the app which is indeed what i wanted

thanks !


 

Jump to:  

cron
  © 1998-2025 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