Package java.awt

Examples of java.awt.Graphics.drawRect()


        g.drawOval(p.getX() - 4, p.getY() - 4, 8, 8);
      } else if (stateMap.containsKey(e.state)) {
        CircuitState substate = stateMap.get(e.state);
        Component subcirc = substate.getSubcircuit();
        Bounds b = subcirc.getBounds();
        g.drawRect(b.getX(), b.getY(), b.getWidth(), b.getHeight());
      }
    }
    GraphicsUtil.switchToWidth(g, 1);
  }
 
View Full Code Here


      }
     
      g.setColor(color);
      g.fillRect(x, y, w - DEPTH, h - DEPTH);
      g.setColor(Color.BLACK);
      g.drawRect(x, y, w - DEPTH, h - DEPTH);
    } else {
      depress = 0;
      int[] xp = new int[] { x, x + w - DEPTH, x + w, x + w, x + DEPTH, x };
      int[] yp = new int[] { y, y, y + DEPTH, y + h, y + h, y + h - DEPTH };
      g.setColor(color.darker());
View Full Code Here

      g.setColor(color.darker());
      g.fillPolygon(xp, yp, xp.length);
      g.setColor(color);
      g.fillRect(x, y, w - DEPTH, h - DEPTH);
      g.setColor(Color.BLACK);
      g.drawRect(x, y, w - DEPTH, h - DEPTH);
      g.drawLine(x + w - DEPTH, y + h - DEPTH, x + w, y + h);
      g.drawPolygon(xp, yp, xp.length);
    }
   
    g.translate(depress, depress);
View Full Code Here

 
  protected abstract void paintIconShaped(InstancePainter painter);
 
  protected void paintIconRectangular(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    g.drawRect(1, 2, 16, 16);
    if (negateOutput) g.drawOval(16, 8, 4, 4);
    String label = getRectangularLabel(painter.getAttributeSet());
    GraphicsUtil.drawCenteredText(g, label, 9, 8);
  }
View Full Code Here

    int len = (width + 3) / 4;

    Graphics g = painter.getGraphics();
    g.setColor(Color.RED);
    if (len > 4) {
      g.drawRect(bds.getX(), bds.getY() + 3, bds.getWidth(), 25);
    } else {
      int wid = 7 * len + 2;
      g.drawRect(bds.getX() + (bds.getWidth() - wid) / 2, bds.getY() + 4, wid, 15);
    }
    g.setColor(Color.BLACK);
View Full Code Here

    g.setColor(Color.RED);
    if (len > 4) {
      g.drawRect(bds.getX(), bds.getY() + 3, bds.getWidth(), 25);
    } else {
      int wid = 7 * len + 2;
      g.drawRect(bds.getX() + (bds.getWidth() - wid) / 2, bds.getY() + 4, wid, 15);
    }
    g.setColor(Color.BLACK);
  }

  @Override
View Full Code Here

  @Override
  public void paintIcon(ComponentDrawContext c, int x, int y) {
    Graphics g = c.getGraphics();
    g.fillRect(x + 2, y + 1, 9, 2);
    g.drawRect(x + 2, y + 3, 15, 12);
    g.setColor(Color.lightGray);
    g.drawLine(x + 4, y + 2, x + 8, y + 2);
    for (int y_offs = y + 6; y_offs < y + 15; y_offs += 3) {
      g.drawLine(x + 4, y_offs, x + 14, y_offs);
    }
View Full Code Here

        }
      }
    }
    g.setColor(Color.BLACK);
    GraphicsUtil.switchToWidth(g, 2);
    g.drawRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
    GraphicsUtil.switchToWidth(g, 1);
    painter.drawPorts();
  }
 
  private static class State implements InstanceData, Cloneable {
View Full Code Here

    @Override
    public void paint(InstancePainter painter) {
      Bounds bds = getBounds(painter);
      Graphics g = painter.getGraphics();
      g.setColor(Color.RED);
      g.drawRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
      g.setColor(Color.BLACK);
    }
 
    @Override
    public void stopEditing(InstanceState state) {
View Full Code Here

 
  @Override
  public void paintIconRectangular(InstancePainter painter) {
    Graphics g = painter.getGraphics();
    g.setColor(Color.black);
    g.drawRect(1, 2, 16, 16);
    Font old = g.getFont();
    g.setFont(old.deriveFont(9.0f));
    GraphicsUtil.drawCenteredText(g, "2k", 96);
    GraphicsUtil.drawCenteredText(g, "+1", 9, 13);
    g.setFont(old);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.