Package java.awt

Examples of java.awt.Color$ColorPaintContext


    return true;
  }
 
  public void paintIcon(Component destination, Graphics g) {
    if (icon == null) {
      g.setColor(new Color(255, 128, 128));
      g.fillRect(4, 4, 8, 8);
      g.setColor(Color.BLACK);
      g.drawLine(4, 4, 12, 12);
      g.drawLine(4, 12, 12, 4);
      g.drawRect(4, 4, 8, 8);
View Full Code Here


    }
  }

  @Override
  public void paintInstance(InstancePainter painter) {
    Color onColor = painter.getAttributeValue(Io.ATTR_ON_COLOR);
    Color offColor = painter.getAttributeValue(Io.ATTR_OFF_COLOR);
    boolean drawSquare = painter.getAttributeValue(ATTR_DOT_SHAPE) == SHAPE_SQUARE;

    State data = getState(painter);
    long ticks = painter.getTickCount();
    Bounds bds = painter.getBounds();
    boolean showState = painter.getShowState();
    Graphics g = painter.getGraphics();
    int rows = data.rows;
    int cols = data.cols;
    for (int j = 0; j < rows; j++) {
      for (int i = 0; i < cols; i++) {
        int x = bds.getX() + 10 * i;
        int y = bds.getY() + 10 * j;
        if (showState) {
          Value val = data.get(j, i, ticks);
          Color c;
          if (val == Value.TRUE) c = onColor;
          else if (val == Value.FALSE) c = offColor;
          else c = Value.ERROR_COLOR;
          g.setColor(c);
         
View Full Code Here

 
  public static Element createText(Document doc, Text text) {
    Element elt = doc.createElement("text");
    Location loc = text.getLocation();
    Font font = text.getValue(DrawAttr.FONT);
    Color fill = text.getValue(DrawAttr.FILL_COLOR);
    Object halign = text.getValue(DrawAttr.ALIGNMENT);
    elt.setAttribute("x", "" + loc.getX());
    elt.setAttribute("y", "" + loc.getY());
    if (!colorMatches(fill, Color.BLACK)) {
      elt.setAttribute("fill", getColorString(fill));
View Full Code Here

      populateStroke(elt, shape);
    }
    if (type == DrawAttr.PAINT_STROKE) {
      elt.setAttribute("fill", "none");
    } else {
      Color fill = shape.getValue(DrawAttr.FILL_COLOR);
      if (colorMatches(fill, Color.BLACK)) {
        elt.removeAttribute("fill");
      } else {
        elt.setAttribute("fill", getColorString(fill));
      }
View Full Code Here

  private static void populateStroke(Element elt, AbstractCanvasObject shape) {
    Integer width = shape.getValue(DrawAttr.STROKE_WIDTH);
    if (width != null && width.intValue() != 1) {
      elt.setAttribute("stroke-width", width.toString());
    }
    Color stroke = shape.getValue(DrawAttr.STROKE_COLOR);
    elt.setAttribute("stroke", getColorString(stroke));
    if (showOpacity(stroke)) {
      elt.setAttribute("stroke-opacity", getOpacityString(stroke));
    }
    elt.setAttribute("fill", "none");
View Full Code Here

public class HexDigit extends InstanceFactory {
  public HexDigit() {
    super("Hex Digit Display", Strings.getter("hexDigitComponent"));
    setAttributes(new Attribute[] { Io.ATTR_ON_COLOR, Io.ATTR_OFF_COLOR,
          Io.ATTR_BACKGROUND },
        new Object[] { new Color(240, 0, 0), SevenSegment.DEFAULT_OFF,
          Io.DEFAULT_BACKGROUND });
    setPorts(new Port[] {
        new Port( 0, 0, Port.INPUT, 4),
        new Port(10, 0, Port.INPUT, 1)
      });
View Full Code Here

 
  public SevenSegment() {
    super("7-Segment Display", Strings.getter("sevenSegmentComponent"));
    setAttributes(new Attribute[] { Io.ATTR_ON_COLOR, Io.ATTR_OFF_COLOR,
          Io.ATTR_BACKGROUND, Io.ATTR_ACTIVE },
        new Object[] { new Color(240, 0, 0), DEFAULT_OFF,
          Io.DEFAULT_BACKGROUND, Boolean.TRUE });
    setOffsetBounds(Bounds.create(-5, 0, 40, 60));
    setIconName("7seg.gif");
    setPorts(new Port[] {
        new Port(200, Port.INPUT, 1),
View Full Code Here

    Bounds bds = painter.getBounds();
    int x = bds.getX() + 5;
    int y = bds.getY();

    Graphics g = painter.getGraphics();
    Color onColor = painter.getAttributeValue(Io.ATTR_ON_COLOR);
    Color offColor = painter.getAttributeValue(Io.ATTR_OFF_COLOR);
    Color bgColor = painter.getAttributeValue(Io.ATTR_BACKGROUND);
    if (painter.shouldDrawColor() && bgColor.getAlpha() != 0) {
      g.setColor(bgColor);
      g.fillRect(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
      g.setColor(Color.BLACK);
    }
    painter.drawBounds();
View Full Code Here

        StdAttr.FACING, Io.ATTR_ON_COLOR, Io.ATTR_OFF_COLOR,
        Io.ATTR_ACTIVE,
        StdAttr.LABEL, Io.ATTR_LABEL_LOC,
        StdAttr.LABEL_FONT, Io.ATTR_LABEL_COLOR
      }, new Object[] {
        Direction.WEST, new Color(240, 0, 0), Color.DARK_GRAY,
        Boolean.TRUE,
        "", Io.LABEL_CENTER,
        StdAttr.DEFAULT_LABEL_FONT, Color.BLACK
      });
    setFacingAttribute(StdAttr.FACING);
View Full Code Here

    Value val = data == null ? Value.FALSE : (Value) data.getValue();
    Bounds bds = painter.getBounds().expand(-1);

    Graphics g = painter.getGraphics();
    if (painter.getShowState()) {
      Color onColor = painter.getAttributeValue(Io.ATTR_ON_COLOR);
      Color offColor = painter.getAttributeValue(Io.ATTR_OFF_COLOR);
      Boolean activ = painter.getAttributeValue(Io.ATTR_ACTIVE);
      Object desired = activ.booleanValue() ? Value.TRUE : Value.FALSE;
      g.setColor(val == desired ? onColor : offColor);
      g.fillOval(bds.getX(), bds.getY(), bds.getWidth(), bds.getHeight());
    }
View Full Code Here

TOP

Related Classes of java.awt.Color$ColorPaintContext

Copyright © 2018 www.massapicom. 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.