示例#1
0
        public override void paint(Graphics g)
        {
            g.setColor(new Color(0xffffff));
            g.fillRect(0, 0, 256, 192);
            for (int i = 0; i < 256; i++)
            {
                int k = memoryUse[i + updateCounter & 0xff];
                g.setColor(new Color(k + 28 << 16));
                g.fillRect(i, 100 - k, 1, k);
            }

            g.setColor(Color.BLACK);
            for (int j = 0; j < displayStrings.Length; j++)
            {
                string s = displayStrings[j];
                if (s != null)
                {
                    g.drawString(s, 32, 116 + j*16);
                }
            }
        }
示例#2
0
 protected internal virtual void paintComponent(Graphics g)
 {
   if (this.image == null)
     g.fillRect(0, 0, ((JComponent) this).getWidth(), ((JComponent) this).getHeight());
   else if (((Boolean) this.__\u003C\u003EaspectKept.getValue()).booleanValue())
   {
     int num1 = (int) ((Component) this).getBounds().width;
     int num2 = (int) ((Component) this).getBounds().height;
     double num3 = Math.min((double) num1 / (double) this.image.getWidth(), (double) num2 / (double) this.image.getHeight());
     g.drawImage((Image) this.image, ByteCodeHelper.d2i((double) num1 - num3 * (double) this.image.getWidth()) / 2, ByteCodeHelper.d2i((double) num2 - num3 * (double) this.image.getHeight()) / 2, ByteCodeHelper.d2i(((double) num1 + num3 * (double) this.image.getWidth()) / 2.0), ByteCodeHelper.d2i((double) num2 + num3 * (double) this.image.getHeight()) / 2, 0, 0, this.image.getWidth(), this.image.getHeight(), (ImageObserver) null);
   }
   else
     g.drawImage((Image) this.image, 0, 0, ((JComponent) this).getWidth(), ((JComponent) this).getHeight(), 0, 0, this.image.getWidth(), this.image.getHeight(), (ImageObserver) null);
 }
		/* Higher Level Drawing Methods */

		/**
		 * Handles painting entire contents of DelaunayPanel.
		 * Called automatically; requested via call to repaint().
		 * @param g the Graphics context
		 */
		protected override void paintComponent(Graphics g)
		{
			// fixme: jsc has trouble calling base...
			//base.paintComponent(g);
			this.g = g;

			// Flood the drawing area with a "background" color
			Color temp = g.getColor();
			if (!isVoronoi) g.setColor(delaunayColor);
			else if (dt.contains(initialTriangle)) g.setColor(this.getBackground());
			else g.setColor(voronoiColor);
			g.fillRect(0, 0, this.getWidth(), this.getHeight());
			g.setColor(temp);

			// Draw the appropriate picture
			if (isVoronoi)
			{
				drawAllVoronoi();
				drawAllSites();
			}
			else drawAllDelaunay();

			// Draw any extra info due to the mouse-entry switches
			temp = g.getColor();
			if (isVoronoi) g.setColor(delaunayColor);
			else g.setColor(voronoiColor);
			if (showCircles) drawAllCircles();
			if (showDelaunay) drawAllDelaunay();
			if (showVoronoi) drawAllVoronoi();
			g.setColor(temp);
		}
 protected internal virtual void paintComponent(Graphics g)
 {
   Dimension size = ((Component) this).getSize();
   switch (((Integer) this.__\u003C\u003Edisplay.getValue()).intValue())
   {
     case 0:
       g.setColor(!this.connected ? (Color) this.__\u003C\u003Enegative.getValue() : (Color) this.__\u003C\u003Epositive.getValue());
       g.fill3DRect(0, 0, (int) size.width, (int) size.height, true);
       break;
     case 1:
       g.setColor(!this.connected ? (Color) this.__\u003C\u003Enegative.getValue() : (Color) this.__\u003C\u003Epositive.getValue());
       g.fill3DRect(0, 0, (int) size.width, (int) size.height, false);
       break;
     case 2:
       g.setColor(((Component) this).getBackground());
       g.fillRect(0, 0, (int) size.width, (int) size.height);
       g.setColor(!this.connected ? (Color) this.__\u003C\u003Enegative.getValue() : (Color) this.__\u003C\u003Epositive.getValue());
       g.fillRoundRect(0, 0, (int) size.width, (int) size.height, 8, 8);
       break;
     default:
       g.setColor(!this.connected ? (Color) this.__\u003C\u003Enegative.getValue() : (Color) this.__\u003C\u003Epositive.getValue());
       g.fillRect(0, 0, (int) size.width, (int) size.height);
       break;
   }
 }