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

📄 draw_quote.java

📁 java 写的股票技术分析;软件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// NMI's Java Code Viewer 6.0a
// www.trinnion.com/javacodeviewer

// Registered to Evaluation Copy                                      
// Generated PGFZKD AyTB 14 2007 15:44:19 

//source File Name:   Draw_Quote.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

public class Draw_Quote {

    public Draw_Quote() {
    }

    static void Paint(Graphics g, Rectangle rc, ProductData product, String code, int iShowBuySellNum, HQApplet applet) {
        g.setFont(new Font("\u6977\u4F53_GB2312", 1, 26));
        FontMetrics fm = g.getFontMetrics();
        g.setColor(HQApplet.rhColor.clProductName);
        int iAsecent = fm.getAscent();
        int iDescent = fm.getHeight() - iAsecent;
        int x = rc.x;
        int y = rc.y + iAsecent;
        CodeTable s = null;
        if(applet.m_htProduct != null && applet.m_htProduct.get(code) != null)
            s = (CodeTable)applet.m_htProduct.get(code);
        String str;
        if(s != null)
            str = s.sName;
        else
            str = "\u2014\u2014\u2014\u2014";
        if(str.equals(code))
            code = "";
        FontMetrics oldFm = fm;
        int fontSize = 26;
        for(; fm.stringWidth(str + code) > rc.width; fm = g.getFontMetrics()) {
            fontSize--;
            g.setFont(new Font("\u6977\u4F53_GB2312", 1, fontSize));
        }

        if(y + iDescent < rc.y + rc.height)
            g.drawString(str, x, y);
        g.setColor(HQApplet.rhColor.clItem);
        str = code;
        x = (rc.x + rc.width) - fm.stringWidth(str);
        if(y + iDescent < rc.y + rc.height)
            g.drawString(str, x, y);
        y += iDescent;
        fm = oldFm;
        g.setColor(HQApplet.rhColor.clGrid);
        if(fm.getHeight() < rc.height)
            g.drawRect(rc.x, rc.y + fm.getHeight(), rc.width - 1, rc.height - fm.getHeight());
        g.setColor(HQApplet.rhColor.clItem);
        g.setFont(new Font("\u5B8B\u4F53", 0, 16));
        fm = g.getFontMetrics();
        iAsecent = fm.getAscent();
        iDescent = fm.getHeight() - iAsecent;
        x = rc.x + 1;
        y += iAsecent;
        int y1 = y;
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("ConsignRate"), x, y);
            g.drawString(applet.getShowString("ConsignDiff"), x + rc.width / 2, y);
            g.setColor(HQApplet.rhColor.clGrid);
            y += iDescent;
            g.drawLine(rc.x, y, rc.x + rc.width, y);
        }
        g.setColor(HQApplet.rhColor.clItem);
        y += iAsecent;
        for(int i = iShowBuySellNum - 1; i >= 0; i--) {
            if(y + iDescent < rc.y + rc.height)
                g.drawString(applet.getShowString("Sell") + applet.getShowString((new StringBuffer(String.valueOf(i + 1))).toString()), x, y);
            y += fm.getHeight();
        }

        y -= fm.getHeight();
        g.setColor(HQApplet.rhColor.clGrid);
        y += iDescent;
        if(y < rc.y + rc.height)
            g.drawLine(rc.x, y, rc.x + rc.width, y);
        g.setColor(HQApplet.rhColor.clItem);
        x = rc.x + 1;
        y += iAsecent;
        for(int i = 0; i < iShowBuySellNum; i++) {
            if(y + iDescent < rc.y + rc.height)
                g.drawString(applet.getShowString("Buy") + applet.getShowString((new StringBuffer(String.valueOf(i + 1))).toString()), x, y);
            y += fm.getHeight();
        }

        y -= fm.getHeight();
        g.setColor(HQApplet.rhColor.clGrid);
        y += iDescent;
        if(y < rc.y + rc.height)
            g.drawLine(rc.x, y, rc.x + rc.width, y);
        g.setColor(HQApplet.rhColor.clItem);
        x = rc.x + 1;
        y += iAsecent;
        if(y + iDescent < rc.y + rc.height)
            g.drawString(applet.getShowString("Newly"), x, y);
        y += fm.getHeight();
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("ChangeValue"), x, y);
            g.drawString(applet.getShowString("Open"), x + rc.width / 2, y);
        }
        y += fm.getHeight();
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("ChangeRate"), x, y);
            g.drawString(applet.getShowString("High"), x + rc.width / 2, y);
        }
        y += fm.getHeight();
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("CurVol"), x, y);
            g.drawString(applet.getShowString("Low"), x + rc.width / 2, y);
        }
        y += fm.getHeight();
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("TotalVolume"), x, y);
            g.drawString(applet.getShowString("VolRate"), x + rc.width / 2, y);
        }
        y += fm.getHeight();
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("Balance"), x, y);
            g.drawString(applet.getShowString("PreBalance1"), x + rc.width / 2, y);
        }
        y += fm.getHeight();
        if(y + iDescent < rc.y + rc.height) {
            g.drawString(applet.getShowString("Order1"), x, y);
            g.drawString(applet.getShowString("OrderChange"), x + rc.width / 2, y);
        }
        g.setColor(HQApplet.rhColor.clGrid);
        y += iDescent;
        if(y < rc.y + rc.height)
            g.drawLine(rc.x, y, rc.x + rc.width, y);
        g.setColor(HQApplet.rhColor.clItem);
        y += iAsecent;
        if(y + iDescent < rc.y + rc.height + 1) {
            g.drawString(applet.getShowString("AskVolume"), x, y);
            g.drawString(applet.getShowString("BidVolume"), x + rc.width / 2, y);
        }
        if(product == null)
            return;
        int iStockType = applet.getProductType(product.sCode);
        int iPrecision = applet.GetPrecision(product.sCode);
        y = y1;
        if(y + iDescent > rc.y + rc.height)
            return;
        float fBuyP[] = new float[5];
        float fBuyV[] = new float[5];
        float fSellP[] = new float[5];
        float fSellV[] = new float[5];
        String str1;
        if(product != null && product.realData != null) {
            fBuyP[0] = product.realData.buyPrice[0];
            fBuyP[1] = product.realData.buyPrice[1];
            fBuyP[2] = product.realData.buyPrice[2];
            fBuyP[3] = product.realData.buyPrice[3];
            fBuyP[4] = product.realData.buyPrice[4];
            fBuyV[0] = product.realData.buyAmount[0];
            fBuyV[1] = product.realData.buyAmount[1];
            fBuyV[2] = product.realData.buyAmount[2];
            fBuyV[3] = product.realData.buyAmount[3];
            fBuyV[4] = product.realData.buyAmount[4];
            fSellP[0] = product.realData.sellPrice[0];
            fSellP[1] = product.realData.sellPrice[1];
            fSellP[2] = product.realData.sellPrice[2];
            fSellP[3] = product.realData.sellPrice[3];
            fSellP[4] = product.realData.sellPrice[4];
            fSellV[0] = product.realData.sellAmount[0];
            fSellV[1] = product.realData.sellAmount[1];
            fSellV[2] = product.realData.sellAmount[2];
            fSellV[3] = product.realData.sellAmount[3];
            fSellV[4] = product.realData.sellAmount[4];
            float fSellVol = fSellV[0] + fSellV[1] + fSellV[2];
            float fBuyVol = fBuyV[0] + fBuyV[1] + fBuyV[2];
            float fDiff = fBuyVol - fSellVol;
            if((double)(fBuyVol + fSellVol) < 0.001D)
                str = "\u2014";
            else
                str = Common.FloatToString((fDiff / (fBuyVol + fSellVol)) * 100F, 2) + "%";
            if(fDiff > 0.0F) {
                str = "+" + str;
                str1 = String.valueOf((int)fDiff);
                g.setColor(HQApplet.rhColor.clIncrease);
            } else
            if(fDiff < 0.0F) {
                str1 = String.valueOf(-(int)fDiff);
                g.setColor(HQApplet.rhColor.clDecrease);
            } else {
                str1 = "0";
                g.setColor(HQApplet.rhColor.clEqual);
            }
        } else {
            str = "\u2014";
            str1 = "\u2014";
            g.setColor(HQApplet.rhColor.clEqual);
        }

⌨️ 快捷键说明

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