GetWhiteLabelData.java

注意事項:
サンプルソースコードには実際にオーダーを発注するものがあります。
サンプルソースコードのストラテジーを起動する場合は、注意して下さい。



// Copyright (c) 2009 Dukascopy (Suisse) SA. All Rights Reserved.
package jforex.dataservice;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;

import com.dukascopy.api.*;

public class GetWhiteLabelData implements IStrategy {

    @Override
    public void onStart(IContext context) throws JFException {
        IConsole     console       = context.getConsole();
        IDataService dataService   = context.getDataService();

        IWLabelData whiteLabelData = dataService.getWhiteLabelData();

        console.getOut().println("Short Name: " + whiteLabelData.getShortName());
        console.getOut().println("Long Name: "  + whiteLabelData.getLongName());
        console.getOut().println("URL: "        + whiteLabelData.getUrl());
        console.getOut().println("Skype: "      + whiteLabelData.getSkype());
        console.getOut().println("Phone: "      + whiteLabelData.getPhone());
        console.getOut().println("Skype: "      + whiteLabelData.getSkype());

        showImage("White Label Splash", whiteLabelData.getSplash());
        showImage("White Label Logo",   whiteLabelData.getLogo());
        showImage("White Label Splash", whiteLabelData.getIcon());

        context.stop();

    }

    private void showImage(String imageName, BufferedImage image) {
        JFrame splashFrame = new JFrame("White Label Splash");
        splashFrame.add(new MyLoadImage(image));
        splashFrame.pack();
        splashFrame.setVisible(true);
    }
    
    private class MyLoadImage extends Component {
        private static final long serialVersionUID = -501560241194053927L;

        private Image img;

        public MyLoadImage(Image image) {
            img = image;
        }

        public void paint(Graphics g) {
            g.drawImage(img, 0, 0, null);
        }

        public Dimension getPreferredSize() {
            if (img == null) {
                return new Dimension(100, 100);
            } else {
                return new Dimension(img.getWidth(null), img.getHeight(null));
            }
        }
    }
    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onStop() throws JFException {}
}







スポンサーリンク

スポンサーリンク
検索
リファレンスツリー


Copyright ©2016 JForexAPIで自動売買させ隊! All Rights Reserved.


Top

inserted by FC2 system