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

📄 page_bottom.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_Bottom.java

package gnnt.MEBS.HQApplet;

import gnnt.MEBS.hq.ProductDataVO;
import java.awt.*;
import java.util.Hashtable;

// Referenced classes of package gnnt.MEBS.HQApplet:
//            HQApplet, RHColor, CodeTable, ProductData, 
//            Common, Draw_Quote

public class Page_Bottom
{

    HQApplet m_applet;
    Graphics g;
    Rectangle rc;
    Rectangle m_rcIndex;
    Rectangle m_rcTime;
    Font font;

    public Page_Bottom(Graphics _g, Rectangle _rc, HQApplet applet)
    {
        font = new Font("宋体", 0, 16);
        g = _g;
        rc = _rc;
        m_applet = applet;
    }

    void Paint()
    {
        g.setFont(font);
        FontMetrics fm = g.getFontMetrics();
        int iWidth = fm.stringWidth("2005-12-24 09:30") + 2;
        m_rcIndex = new Rectangle(rc.x, rc.y, rc.width - iWidth, rc.height);
        m_rcTime = new Rectangle((rc.x + rc.width) - iWidth, rc.y, iWidth, rc.height);
        g.setColor(HQApplet.rhColor.clBackGround);
        g.fillRect(rc.x, rc.y, rc.x + rc.width, rc.y + rc.height);
        g.setColor(HQApplet.rhColor.clGrid);
        g.drawLine(rc.x, rc.y, rc.width, rc.y);
        g.drawLine(m_rcTime.x - 1, rc.y, m_rcTime.x - 1, rc.y + rc.height);
        if(rc.height < fm.getHeight() / 2)
        {
            return;
        } else
        {
            PaintIndex();
            PaintCurTime();
            return;
        }
    }

    private void PaintIndex()
    {
        if(m_applet.indexMainCode.length() == 0)
            return;
        if(m_applet.m_bShowIndexAtBottom == 0)
            return;
        CodeTable s = null;
        if(m_applet.m_htProduct != null && m_applet.m_htProduct.get(m_applet.indexMainCode) != null)
            s = (CodeTable)m_applet.m_htProduct.get(m_applet.indexMainCode);
        String strName;
        if(s != null)
            strName = s.sName;
        else
            strName = "  指数  ";
        ProductData product = m_applet.GetProductData(m_applet.indexMainCode);
        if(product == null || product.realData == null)
            return;
        FontMetrics fm = g.getFontMetrics();
        int x = m_rcIndex.x + 2;
        if((m_rcIndex.x + m_rcIndex.width) - x < fm.stringWidth(strName))
            return;
        g.setColor(HQApplet.rhColor.clProductName);
        g.drawString(strName, x, m_rcIndex.y + fm.getAscent());
        x += fm.stringWidth(strName) + 10;
        String str;
        if(product.realData.curPrice > 0.0F)
            str = Common.FloatToString(product.realData.curPrice, m_applet.m_iPrecisionIndex);
        else
            str = "——";
        if((m_rcIndex.x + m_rcIndex.width) - x < fm.stringWidth(str))
            return;
        g.setColor(Draw_Quote.GetPriceColor(product.realData.curPrice, product.realData.yesterBalancePrice));
        g.drawString(str, x, m_rcIndex.y + fm.getAscent());
        x += fm.stringWidth(str) + 10;
        if(product.realData.curPrice > 0.0F && product.realData.yesterBalancePrice > 0.0F)
            str = Common.FloatToString(product.realData.curPrice - product.realData.yesterBalancePrice, m_applet.m_iPrecisionIndex);
        else
            str = "——";
        if(product.realData.curPrice > product.realData.yesterBalancePrice)
            str = "+" + str;
        else
        if(product.realData.curPrice * 100F == product.realData.yesterBalancePrice * 100F)
            str = "——";
        if((m_rcIndex.x + m_rcIndex.width) - x < fm.stringWidth(str))
            return;
        g.setColor(Draw_Quote.GetPriceColor(product.realData.curPrice, product.realData.yesterBalancePrice));
        g.drawString(str, x, m_rcIndex.y + fm.getAscent());
        x += fm.stringWidth(str) + 10;
        str = m_applet.getShowString("Volume");
        if(product.realData.totalAmount > 0L)
            str = str + String.valueOf((int)product.realData.totalAmount);
        else
            str = str + "——";
        if((m_rcIndex.x + m_rcIndex.width) - x < fm.stringWidth(str))
            return;
        g.setColor(HQApplet.rhColor.clVolume);
        g.drawString(str, x, m_rcIndex.y + fm.getAscent());
        x += fm.stringWidth(str) + 10;
        str = m_applet.getShowString("Order");
        if(product.realData.reserveCount > 0)
            str = str + String.valueOf(product.realData.reserveCount);
        else
            str = str + "——";
        if((m_rcIndex.x + m_rcIndex.width) - x < fm.stringWidth(str))
        {
            return;
        } else
        {
            g.setColor(HQApplet.rhColor.clReserve);
            g.drawString(str, x, m_rcIndex.y + fm.getAscent());
            return;
        }
    }

    private void PaintCurTime()
    {
        if(m_applet.m_iDate == 0 || m_applet.m_iDate == 0)
            return;
        g.setColor(HQApplet.rhColor.clItem);
        String strTime;
        for(strTime = String.valueOf(m_applet.m_iTime / 100); strTime.length() < 4; strTime = "0" + strTime);
        strTime = strTime.substring(0, 2) + ":" + strTime.substring(2);
        String strText = m_applet.m_iDate / 10000 + "-" + (m_applet.m_iDate / 100) % 100 + "-" + m_applet.m_iDate % 100 + " " + strTime;
        FontMetrics fm = g.getFontMetrics();
        g.drawString(strText, m_rcTime.x, m_rcTime.y + fm.getAscent());
    }
}

⌨️ 快捷键说明

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