예제 #1
0
 public virtual void  paint(Graphics g)
 {
     g.setColor(0xFFFFFF);
     g.fillRect(0, 0, getWidth(), getHeight());
     if (message1 != null)
     {
         g.setColor(0x000000);
         g.drawString(message1, 1, 1, Graphics.TOP | Graphics.LEFT);
         g.drawString(message2, 1, 1 + g.getFont().getHeight(), Graphics.TOP | Graphics.LEFT);
     }
 }
예제 #2
0
    internal virtual void drawGraph(javax.microedition.lcdui.Graphics g)
    {
        int old = g.Color;

        g.Color = LIGHTGRAY;
        g.fillRect(0, 0, width, height);
        for (int i = 0; i < PlotLines.Count; i++)
        {
            PlotLine line = (PlotLine)PlotLines[i];
            line.paint(g);
        }
        g.Color = old;
        drawAxis(g);
    }
예제 #3
0
 public virtual void  paint(Graphics g)
 {
     g.setColor(0xFFFFFF);
     g.fillRect(0, 0, getWidth(), getHeight());
     if (image != null)
     {
         g.drawImage(image, getWidth() / 2, getHeight() / 2, Graphics.VCENTER | Graphics.HCENTER);
     }
     g.setColor(0x000000);
     for (int i = 0; i < log.Length; i++)
     {
         if (log[i] != null)
         {
             g.drawString(log[i], 0, i * logFont.getHeight(), Graphics.TOP | Graphics.LEFT);
         }
     }
 }
예제 #4
0
    internal virtual void drawPointer(javax.microedition.lcdui.Graphics g)
    {
        g.Color = RED;
        fillCircle(g, xp, yp, 3);
        g.Color = WHITE;
        g.fillRect(xp, yp, 1, 1);
        double X = getXCoordinate(xp);

        if (plotmode == LOGLIN || plotmode == LOGLOG)
        {
            X = JMath.pow(10.0, X);
        }
        double Y = getYCoordinate(yp);

        if (plotmode == LINLOG || plotmode == LOGLOG)
        {
            Y = JMath.pow(10.0, Y);
        }
        drawMessage(g, xp, yp, new string[] { "X=" + fmt.ToString(X), "Y=" + fmt.ToString(Y) });
    }
예제 #5
0
    internal virtual void drawMessage(javax.microedition.lcdui.Graphics g, int xp, int yp, string[] msg)
    {
        double[] sw = new double[msg.Length];
        for (int i = 0; i < sw.Length; i++)
        {
            sw[i] = g.Font.stringWidth(msg[i]);
        }
        int fh = g.Font.Height;
        int mw = (int)max(sw) + 10, mh = msg.Length * fh + 6;
        int xw = xp < width / 2 ? width - xright - mw : xleft;
        int yw = yp < height / 2 ? height - ybottom - mh : ytop;

        g.Color = WHITE;
        g.fillRect(xw, yw, mw, mh);
        g.Color = BLACK;
        for (int i = 0; i < msg.Length; i++)
        {
            g.drawString(msg[i], xw + 5, yw + (i + 1) * fh + 3, g.BOTTOM | g.LEFT);
        }
    }
예제 #6
0
    public virtual void fillCircle(javax.microedition.lcdui.Graphics g, int x, int y, int r)
    {
        int r2 = r * r;

        for (int yd = y - r; yd < y + r; yd++)
        {
            if (yd >= 0 && yd < height)
            {
                int y2 = (yd - y) * (yd - y);
                for (int xd = x - r; xd < x + r; xd++)
                {
                    if (xd >= 0 && xd < width)
                    {
                        if (y2 + (xd - x) * (xd - x) <= r2)
                        {
                            g.fillRect(xd, yd, 1, 1);
                        }
                    }
                }
            }
        }
    }