⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page_minline.java

📁 一份java写的期货交易程序
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   Page_MinLine.java

package gnnt.MEBS.HQApplet;

import gnnt.MEBS.hq.BillDataVO;
import gnnt.MEBS.hq.ProductDataVO;
import gnnt.util.service.HQVO.CMDBillVO;
import gnnt.util.service.HQVO.CMDMinVO;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.Vector;

// Referenced classes of package gnnt.MEBS.HQApplet:
//            Page_Main, MenuListener, HQApplet, ProductData, 
//            SendThread, Draw_MinLine, Draw_Quote, Draw_LastBill

class Page_MinLine extends Page_Main
{

    int iProductType;
    MenuItem menuPrevStock;
    MenuItem menuPostStock;
    MenuItem menuPageKLine;
    MenuItem menuPageBill;
    MenuItem menuQuote;
    MenuItem menuMarket;
    Draw_MinLine draw_MinLine;
    Rectangle rcMinLine;
    int m_iQuoteH;

    void AskForDataOnTimer()
    {
        ProductData stock = m_applet.GetProductData(m_applet.strCurrentCode);
        java.util.Date time = null;
        if(stock != null && stock.realData != null)
            time = stock.realData.time;
        SendThread.AskForRealQuote(m_applet.strCurrentCode, time, m_applet.sendThread);
        CMDBillVO packet = new CMDBillVO();
        packet.type = 0;
        packet.code = m_applet.strCurrentCode;
        if(stock != null && stock.vBill != null && stock.vBill.size() > 0)
            packet.time = ((BillDataVO)stock.vBill.lastElement()).time;
        m_applet.sendThread.AskForData(packet);
    }

    void AskForDataOnce()
    {
        ProductData stock = m_applet.GetProductData(m_applet.strCurrentCode);
        java.util.Date time = null;
        if(stock != null && stock.realData != null)
            time = stock.realData.time;
        SendThread.AskForRealQuote(m_applet.strCurrentCode, time, m_applet.sendThread);
        CMDMinVO packet1 = new CMDMinVO();
        packet1.code = m_applet.strCurrentCode;
        packet1.type = 0;
        packet1.time = 0;
        m_applet.sendThread.AskForData(packet1);
        CMDBillVO packet = new CMDBillVO();
        packet.type = 1;
        packet.code = m_applet.strCurrentCode;
        packet.time = (m_rc.height - 320) / 16 + 1;
        m_applet.sendThread.AskForData(packet);
    }

    public Page_MinLine(Rectangle _rc, HQApplet applet)
    {
        super(_rc, applet);
        m_iQuoteH = 380;
        AskForDataOnce();
        applet.iCurrentPage = 1;
        draw_MinLine = new Draw_MinLine(applet, true);
        makeMenus();
        iProductType = applet.getProductType(applet.strCurrentCode);
    }

    void Paint(Graphics g)
    {
        ProductData stock = m_applet.GetProductData(m_applet.strCurrentCode);
        g.setFont(new Font("楷体_GB2312", 1, 26));
        FontMetrics fm = g.getFontMetrics();
        m_iQuoteH = fm.getHeight();
        g.setFont(new Font("宋体", 0, 16));
        fm = g.getFontMetrics();
        int _tmp = iProductType;
        m_iQuoteH += 9 * fm.getHeight() + m_applet.iShowBuySellPrice * 2 * fm.getHeight();
        Rectangle rcQuote = new Rectangle((m_rc.x + m_rc.width) - 200, m_rc.y, 200, m_iQuoteH);
        if(rcQuote.height > m_rc.height)
            rcQuote.height = m_rc.height;
        int _tmp1 = iProductType;
        Draw_Quote.Paint(g, rcQuote, stock, m_applet.strCurrentCode, m_applet.iShowBuySellPrice, m_applet);
        Rectangle rcBill = new Rectangle((m_rc.x + m_rc.width) - 200, m_rc.y + m_iQuoteH, 200, (m_rc.height - m_iQuoteH) + 1);
        Draw_LastBill.Paint(g, rcBill, stock, m_applet);
        rcMinLine = new Rectangle(m_rc.x, m_rc.y, m_rc.width - 200, m_rc.height);
        draw_MinLine.Paint(g, rcMinLine, stock);
    }

    boolean KeyPressed(KeyEvent e)
    {
        int iKeyCode = e.getKeyCode();
        boolean bResult;
        switch(iKeyCode)
        {
        case 34: // '"'
            m_applet.ChangeStock(false, false);
            bResult = true;
            break;

        case 33: // '!'
            m_applet.ChangeStock(true, false);
            bResult = true;
            break;

        default:
            bResult = draw_MinLine.KeyPressed(iKeyCode);
            break;
        }
        return bResult;
    }

    boolean MouseLeftClicked(int x, int y)
    {
        if(rcMinLine != null && rcMinLine.contains(x, y) && draw_MinLine != null)
            return draw_MinLine.MouseLeftClicked(x, y);
        else
            return false;
    }

    boolean MouseDragged(int x, int y)
    {
        if(rcMinLine != null && rcMinLine.contains(x, y) && draw_MinLine != null)
            return draw_MinLine.MouseDragged(x, y);
        else
            return false;
    }

    void makeMenus()
    {
        menuPrevStock = new MenuItem(m_applet.getShowString("PrevCommodity") + "  PageUp");
        menuPostStock = new MenuItem(m_applet.getShowString("NextCommodity") + "  PageDown");
        menuPageKLine = new MenuItem(m_applet.getShowString("Analysis") + "  F5");
        menuPageBill = new MenuItem(m_applet.getShowString("TradeList") + "  F1");
        menuQuote = new MenuItem(m_applet.getShowString("MultiQuote") + "  F2");
        menuMarket = new MenuItem(m_applet.getShowString("ClassedList") + "  F4");
        menuPageKLine.setActionCommand("kline");
        menuPageKLine.addActionListener(this);
        menuPageBill.setActionCommand("bill");
        menuPageBill.addActionListener(this);
        menuPrevStock.setActionCommand("prevstock");
        menuPrevStock.addActionListener(this);
        menuPostStock.setActionCommand("poststock");
        menuPostStock.addActionListener(this);
        menuQuote.setActionCommand("cmd_quote");
        menuQuote.addActionListener(this);
        menuMarket.setActionCommand("cmd_market");
        menuMarket.addActionListener(this);
    }

    public void processMenuEvent(PopupMenu popupMenu, int x, int y)
    {
        popupMenu.removeAll();
        popupMenu.add(menuPageKLine);
        if(iProductType != 2 && iProductType != 3)
            popupMenu.add(menuPageBill);
        popupMenu.addSeparator();
        popupMenu.add(menuPrevStock);
        popupMenu.add(menuPostStock);
        popupMenu.addSeparator();
        popupMenu.add(menuQuote);
        popupMenu.add(menuMarket);
        processCommonMenuEvent(popupMenu, this);
        popupMenu.show(m_applet, x, y);
    }

    public void actionPerformed(ActionEvent e)
    {
        String cmd = e.getActionCommand();
        if(cmd.indexOf("cmd_") >= 0)
        {
            String requestType = cmd.substring(4);
            if(requestType.equals("quote"))
                executeQuoteCommand();
            else
            if(requestType.equals("market"))
                executeMarketCommand();
        } else
        if(cmd.equals("kline"))
            m_applet.showPageKLine(m_applet.strCurrentCode);
        else
        if(cmd.equals("bill"))
            m_applet.UserCommand("01");
        else
        if(cmd.equals("prevstock"))
        {
            m_applet.ChangeStock(true, false);
            m_applet.repaint();
        } else
        if(cmd.equals("poststock"))
        {
            m_applet.ChangeStock(false, false);
            m_applet.repaint();
        } else
        {
            super.actionPerformed(e);
        }
    }

    private void executeQuoteCommand()
    {
        m_applet.UserCommand("60");
    }

    private void executeMarketCommand()
    {
        m_applet.UserCommand("80");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -