Esempio n. 1
1
  public void paint(Graphics g) {
    // paint()
    int x, y;
    Random place = new Random(WorldParams.version);
    g.translate(5, 25);
    Color curColor = new Color(0, 0, 0);

    if (pleaseDraw) {
      for (int i = 0; i < WorldParams.worldXsize; i++)
        for (int j = 0; j < WorldParams.worldYsize; j++) {
          curColor = new Color(0, 0, 0);
          if (World2D.cWorld[i][j].hereIsGrass) curColor = new Color(0, 100, 0);
          g.setColor(curColor);
          g.fillRect(i * scale, j * scale, scale, scale);
          if (World2D.cWorld[i][j].agents.size() > 0) {
            for (int z = 0; z < World2D.cWorld[i][j].agents.size(); z++) {
              x = place.nextInt(scale - 8);
              y = place.nextInt(scale - 8);
              agent = (Genome) World2D.cWorld[i][j].agents.elementAt(z);
              switch (agent.act) {
                case 0: // rest
                  curColor = new Color(255, 255, 255);
                  break;
                case 1: // eat
                  curColor = new Color(255, 255, 0);
                  break;
                case 2: // moving
                  curColor = new Color(100, 100, 250);
                  break;
                case 3: // turn left
                  curColor = new Color(0, 0, 255);
                  break;
                case 4: // turn right
                  curColor = new Color(0, 0, 255);
                  break;
                case 5: // divide
                  curColor = new Color(255, 50, 150);
                  break;
                case 6: // fight
                  curColor = new Color(255, 0, 0);
                  break;
              } // end switch
              g.setColor(curColor);
              g.fillRect(i * scale + x, j * scale + y, 8, 8);
            }
          }
        }
    }
    pleaseDraw = false;
    if (fForm_Create) InitialPositionSet();
  } // End of paint()
    public void paintIcon(Component c, Graphics g, int x, int y) {
      Color color = c == null ? Color.GRAY : c.getBackground();
      // In a compound sort, make each succesive triangle 20%
      // smaller than the previous one.
      int dx = (int) (size / 2 * Math.pow(0.8, priority));
      int dy = descending ? dx : -dx;
      // Align icon (roughly) with font baseline.
      y = y + 5 * size / 6 + (descending ? -dy : 0);
      int shift = descending ? 1 : -1;
      g.translate(x, y);

      // Right diagonal.
      g.setColor(color.darker());
      g.drawLine(dx / 2, dy, 0, 0);
      g.drawLine(dx / 2, dy + shift, 0, shift);

      // Left diagonal.
      g.setColor(color.brighter());
      g.drawLine(dx / 2, dy, dx, 0);
      g.drawLine(dx / 2, dy + shift, dx, shift);

      // Horizontal line.
      if (descending) {
        g.setColor(color.darker().darker());
      } else {
        g.setColor(color.brighter().brighter());
      }
      g.drawLine(dx, 0, 0, 0);

      g.setColor(color);
      g.translate(-x, -y);
    }
 @Override
 protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
   int shift = isMirrored() ? -9 : 9;
   g.translate(shift, 0);
   super.paintThumb(g, c, thumbBounds);
   g.translate(-shift, 0);
 }
Esempio n. 4
0
 public void paintIcon(Component c, Graphics g, int x, int y) {
   if (WindowsMenuItemUI.isVistaPainting()) {
     XPStyle xp = XPStyle.getXP();
     State state = State.NORMAL;
     if (c instanceof JMenuItem) {
       state = ((JMenuItem) c).getModel().isEnabled() ? State.NORMAL : State.DISABLED;
     }
     Skin skin = xp.getSkin(c, Part.MP_POPUPSUBMENU);
     if (WindowsGraphicsUtils.isLeftToRight(c)) {
       skin.paintSkin(g, x, y, state);
     } else {
       Graphics2D g2d = (Graphics2D) g.create();
       g2d.translate(x + skin.getWidth(), y);
       g2d.scale(-1, 1);
       skin.paintSkin(g2d, 0, 0, state);
       g2d.dispose();
     }
   } else {
     g.translate(x, y);
     if (WindowsGraphicsUtils.isLeftToRight(c)) {
       g.drawLine(0, 0, 0, 7);
       g.drawLine(1, 1, 1, 6);
       g.drawLine(2, 2, 2, 5);
       g.drawLine(3, 3, 3, 4);
     } else {
       g.drawLine(4, 0, 4, 7);
       g.drawLine(3, 1, 3, 6);
       g.drawLine(2, 2, 2, 5);
       g.drawLine(1, 3, 1, 4);
     }
     g.translate(-x, -y);
   }
 }
    public void paintIcon(Component c, Graphics g, int x, int y) {
      boolean enabled = c.isEnabled();

      // paint the icon
      Icon paintedIcon = enabled ? icon : disabledIcon;
      if (paintedIcon != null) paintedIcon.paintIcon(c, g, x, y);

      // backup current color
      Color oldColor = g.getColor();
      int insetx = 4;
      if (c instanceof JComponent) {
        Insets borderinset = ((JComponent) c).getBorder().getBorderInsets(c);
        insetx = borderinset.left;
      }
      if (paintedIcon != null) {
        g.translate(paintedIcon.getIconWidth() + X_GAP + insetx, 0);
      }

      arrow.paintIcon(c, g, x, y);
      if (paintedIcon != null) {
        g.translate(-paintedIcon.getIconWidth() - X_GAP - insetx, 0);
      }

      // restore previous color
      g.setColor(oldColor);
    }
    @Override
    public void paintComponent(Graphics g) {
      Graphics g2 = g.create();

      Dimension d = getSize();
      CPArtwork artwork = controller.getArtwork();
      Object[] layers = artwork.getLayers();

      g2.setColor(new Color(0x606060));
      g2.fillRect(0, 0, d.width, d.height - layers.length * layerH);

      g2.setColor(Color.black);
      g2.translate(0, d.height - layerH);
      for (int i = 0; i < layers.length; i++) {
        drawLayer(g2, (CPLayer) layers[i], i == artwork.getActiveLayerNb());
        g2.translate(0, -layerH);
      }

      if (layerDragReally) {
        g2.translate(0, layers.length * layerH - (d.height - layerH));
        g2.drawRect(0, layerDragY - layerH / 2, d.width, layerH);

        int layerOver = (d.height - layerDragY) / layerH;
        if (layerOver <= layers.length
            && layerOver != layerDragNb
            && layerOver != layerDragNb + 1) {
          g2.fillRect(0, d.height - layerOver * layerH - 2, d.width, 4);
        }
      }
    }
 private static void drawSelection(JTree tree, Graphics g, final int width) {
   int y = 0;
   final int[] rows = tree.getSelectionRows();
   final int height = tree.getRowHeight();
   for (int row : rows) {
     final TreeCellRenderer renderer = tree.getCellRenderer();
     final Object value = tree.getPathForRow(row).getLastPathComponent();
     if (value == null) continue;
     final Component component =
         renderer.getTreeCellRendererComponent(tree, value, false, false, false, row, false);
     if (component.getFont() == null) {
       component.setFont(tree.getFont());
     }
     g.translate(0, y);
     component.setBounds(0, 0, width, height);
     boolean wasOpaque = false;
     if (component instanceof JComponent) {
       final JComponent j = (JComponent) component;
       if (j.isOpaque()) wasOpaque = true;
       j.setOpaque(false);
     }
     component.paint(g);
     if (wasOpaque) {
       ((JComponent) component).setOpaque(true);
     }
     y += height;
     g.translate(0, -y);
   }
 }
 private static void drawSelection(JTable table, int column, Graphics g, final int width) {
   int y = 0;
   final int[] rows = table.getSelectedRows();
   final int height = table.getRowHeight();
   for (int row : rows) {
     final TableCellRenderer renderer = table.getCellRenderer(row, column);
     final Component component =
         renderer.getTableCellRendererComponent(
             table, table.getValueAt(row, column), false, false, row, column);
     g.translate(0, y);
     component.setBounds(0, 0, width, height);
     boolean wasOpaque = false;
     if (component instanceof JComponent) {
       final JComponent j = (JComponent) component;
       if (j.isOpaque()) wasOpaque = true;
       j.setOpaque(false);
     }
     component.paint(g);
     if (wasOpaque) {
       ((JComponent) component).setOpaque(true);
     }
     y += height;
     g.translate(0, -y);
   }
 }
 // }
 public void drawCursor(Graphics g, int width, int height) {
   int x = xCursor * imgWidth;
   g.setColor(ColorScheme.LIST_BGND);
   g.fillRect(0, 0, width, height);
   g.translate(x, 0);
   super.drawCursor(g, imgWidth, lineHeight);
   g.translate(-x, 0);
 }
  // documentation inherited
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g;

    // center the tile display if we are bigger than we need to be
    g.translate(_tx, _ty);

    //         // paint coordinates in the grid that contains our tiles
    //         for (int yy = 0; yy < _height; yy++) {
    //             for (int xx = 0; xx < _width; xx++) {
    //                 int cx = xx*TILE_WIDTH, cy = yy*TILE_HEIGHT;
    //                 g.drawRect(cx, cy, TILE_WIDTH, TILE_HEIGHT);
    //                 String coord = (xx-_origX) + "/" + (yy-_origY);
    //                 g.drawString(coord, cx+TILE_WIDTH/2, cy+TILE_HEIGHT/2);
    //             }
    //         }

    // iterate over our tiles, painting each of them
    for (AtlantiTile tile : _tiles) {
      tile.paint(g2, _origX, _origY);
    }

    // if we have a placing tile, draw that one as well
    if (_placingTile != null && _validPlacement) {
      // if the current position is valid, draw the placing tile
      _placingTile.paint(g2, _origX, _origY);

      // draw a green rectangle around the placing tile
      g.setColor(Color.blue);
      int sx = (_placingTile.x + _origX) * TILE_WIDTH;
      int sy = (_placingTile.y + _origY) * TILE_HEIGHT;
      g.drawRect(sx, sy, TILE_WIDTH - 1, TILE_HEIGHT - 1);
    }

    // if we have a recently placed tile, draw that one as well
    if (_placedTile != null) {
      // draw the tile
      _placedTile.paint(g2, _origX, _origY);

      // draw a white rectangle around the placed tile
      g.setColor(Color.white);
      int sx = (_placedTile.x + _origX) * TILE_WIDTH;
      int sy = (_placedTile.y + _origY) * TILE_HEIGHT;
      g.drawRect(sx, sy, TILE_WIDTH - 1, TILE_HEIGHT - 1);
    }

    // draw a white rectangle around the last placed
    if (_lastPlacedTile != null) {
      g.setColor(Color.white);
      int sx = (_lastPlacedTile.x + _origX) * TILE_WIDTH;
      int sy = (_lastPlacedTile.y + _origY) * TILE_HEIGHT;
      g.drawRect(sx, sy, TILE_WIDTH - 1, TILE_HEIGHT - 1);
    }

    // undo our translations
    g.translate(-_tx, -_ty);
  }
Esempio n. 11
0
 static void drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active) {
   drawButtonBorder(g, x + 1, y + 1, w - 1, h - 1, active);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.translate(-x, -y);
 }
    public void paintIcon(Component c, Graphics g, int x, int y) {
      Color oldColor = g.getColor();
      boolean enabled = c.isEnabled();
      boolean pressed = false;
      if (c instanceof JButton) {
        pressed = ((JButton) c).getModel().isPressed();
      }

      int i = 0;
      int j = 0;
      int w = Math.min(width, c.getWidth());
      int h = c.getHeight();
      if (h < 5 || w < 5) { // not enough space for the arrow
        g.setColor(oldColor);
        return;
      }

      int size = Math.min(h / 2, w / 2);
      size = Math.max(size, 2);
      int mid = size / 2;

      x = ((w - size) / 2); // center arrow
      y = (h - size) / 2; // center arrow
      if (pressed) {
        x++;
        y++;
      }
      g.translate(x, y); // move the x,y origin in the graphic

      if (enabled) g.setColor(UIManager.getColor("controlDkShadow")); // NOT
      // LOCALIZABLE
      else g.setColor(UIManager.getColor("controlShadow")); // NOT
      // LOCALIZABLE

      if (!enabled) {
        g.translate(1, 1);
        g.setColor(UIManager.getColor("controlLtHighlight")); // NOT
        // LOCALIZABLE
        for (i = size - 1; i >= 0; i--) {
          g.drawLine(mid - i, j, mid + i, j);
          j++;
        }
        g.translate(-1, -1);
        g.setColor(UIManager.getColor("controlShadow")); // NOT
        // LOCALIZABLE
      }

      j = 0;
      for (i = size - 1; i >= 0; i--) {
        g.drawLine(mid - i, j, mid + i, j);
        j++;
      }

      g.translate(-x, -y);
      g.setColor(oldColor);
    }
Esempio n. 13
0
  /** This draws a variant "Flush 3D Border" It is used for things like pressed buttons. */
  static void drawPressed3DBorder(Graphics g, int x, int y, int w, int h) {
    g.translate(x, y);

    drawFlush3DBorder(g, 0, 0, w, h);

    g.setColor(MetalLookAndFeel.getControlShadow());
    g.drawLine(1, 1, 1, h - 2);
    g.drawLine(1, 1, w - 2, 1);
    g.translate(-x, -y);
  }
Esempio n. 14
0
  /**
   * Called to draw the panel.
   *
   * @param g Graphics device to draw the panel to.
   */
  public void paintComponent(Graphics g) {
    final Point scrollPosition = getScrollPosition();
    g.translate(-scrollPosition.x, -scrollPosition.y);

    try {
      super.paintComponent(g);
    } finally {
      g.translate(scrollPosition.x, scrollPosition.y);
    }
  }
Esempio n. 15
0
 /** This draws the "Flush 3D Border" which is used throughout the Metal L&F */
 static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h) {
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControlHighlight());
   g.drawRect(1, 1, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(0, h - 1, 1, h - 2);
   g.drawLine(w - 1, 0, w - 2, 1);
   g.translate(-x, -y);
 }
Esempio n. 16
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   g.translate(x, y);
   g.setColor(Color.ORANGE);
   g.drawLine(2, 3, 9, 10);
   g.drawLine(2, 4, 8, 10);
   g.drawLine(3, 3, 9, 9);
   g.drawLine(9, 3, 2, 10);
   g.drawLine(9, 4, 3, 10);
   g.drawLine(8, 3, 2, 9);
   g.translate(-x, -y);
 }
Esempio n. 17
0
 static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h) {
   drawPressed3DBorder(g, x + 1, y + 1, w - 1, h - 1);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(w - 1, 0, w - 1, 0);
   g.drawLine(0, h - 1, 0, h - 1);
   g.translate(-x, -y);
 }
Esempio n. 18
0
  /**
   * Paints the etched line.
   *
   * @param component The component to draw the border on.
   * @param graphics The graphics object.
   * @param x The top-left x.
   * @param y The top-left y.
   * @param width The border width.
   * @param height The border height.
   */
  public void paintBorder(
      Component component, Graphics graphics, int x, int y, int width, int height) {
    graphics.translate(x, y);

    graphics.setColor(
        etchType == LOWERED ? getShadowColor(component) : getHighlightColor(component));
    graphics.drawLine(10, 0, width - 2, 0);

    graphics.setColor(
        etchType == LOWERED ? getHighlightColor(component) : getShadowColor(component));
    graphics.drawLine(10, 1, width - 2, 1);

    graphics.translate(0 - x, 0 - y);
  }
Esempio n. 19
0
 protected void constrainGraphics(Graphics g, Rectangle bounds) {
   if (g instanceof ConstrainableGraphics) {
     ((ConstrainableGraphics) g).constrain(bounds.x, bounds.y, bounds.width, bounds.height);
   } else {
     g.translate(bounds.x, bounds.y);
   }
   g.clipRect(0, 0, bounds.width, bounds.height);
 }
Esempio n. 20
0
 /** ********************************************************************** */
 public void paintComponent(Graphics g) {
   for (int i = 0; i < model.size(); i++) {
     int y = i * cell_height;
     if (y + cell_height < g.getClipY()) continue;
     else if (y > g.getClipY() + g.getClipHeight()) break;
     //
     g.translate(0, y);
     IComponent c =
         renderer.getListCellRendererComponent(
             this, model.elementAt(i), i, selection.isSelectedIndex(i), (rollover == i));
     c.setBounds(0, 0, bounds.width, cell_height);
     c.setFont(font);
     c.setEnabled(enabled);
     c.paint(g);
     g.translate(0, -y);
   }
 }
Esempio n. 21
0
 /** Overrides <code>Graphics.translate</code>. */
 public void translate(int x, int y) {
   if (debugLog()) {
     info().log(toShortString() + " Translating by: " + new Point(x, y));
   }
   xOffset += x;
   yOffset += y;
   graphics.translate(x, y);
 }
Esempio n. 22
0
  /** Paints the horizontal bars for the */
  public void paintIcon(Component c, Graphics g, int x, int y) {
    JComponent component = (JComponent) c;
    int iconWidth = getIconWidth();

    g.translate(x, y);

    g.setColor(
        component.isEnabled()
            ? MetalLookAndFeel.getControlInfo()
            : MetalLookAndFeel.getControlShadow());
    g.drawLine(0, 0, iconWidth - 1, 0);
    g.drawLine(1, 1, 1 + (iconWidth - 3), 1);
    g.drawLine(2, 2, 2 + (iconWidth - 5), 2);
    g.drawLine(3, 3, 3 + (iconWidth - 7), 3);
    g.drawLine(4, 4, 4 + (iconWidth - 9), 4);

    g.translate(-x, -y);
  }
Esempio n. 23
0
 protected void paintImage(
     Component c, Graphics g, int x, int y, int imageW, int imageH, Image image, Object[] args) {
   boolean isVertical = ((Boolean) args[1]).booleanValue();
   // Render to the screen
   g.translate(x, y);
   if (isVertical) {
     for (int counter = 0; counter < w; counter += IMAGE_SIZE) {
       int tileSize = Math.min(IMAGE_SIZE, w - counter);
       g.drawImage(image, counter, 0, counter + tileSize, h, 0, 0, tileSize, h, null);
     }
   } else {
     for (int counter = 0; counter < h; counter += IMAGE_SIZE) {
       int tileSize = Math.min(IMAGE_SIZE, h - counter);
       g.drawImage(image, 0, counter, w, counter + tileSize, 0, 0, w, tileSize, null);
     }
   }
   g.translate(-x, -y);
 }
Esempio n. 24
0
  public void paint(Graphics g) {
    super.paint(g);

    Graphics2D g2 = (Graphics2D) g;
    int size =
        Math.min(
            MAX_SIZE,
            Math.min(
                getWidth() - imagePadding.left - imagePadding.right,
                getHeight() - imagePadding.top - imagePadding.bottom));

    g2.translate(getWidth() / 2 - size / 2, getHeight() / 2 - size / 2);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    Shape shape;

    if (mode == ColorPicker.SAT || mode == ColorPicker.BRI) {
      shape = new Ellipse2D.Float(0, 0, size, size);
    } else {
      Rectangle r = new Rectangle(0, 0, size, size);
      shape = r;
    }

    if (hasFocus()) {
      PaintUtils.paintFocus(g2, shape, 5);
    }

    if (!(shape instanceof Rectangle)) {
      // paint a circular shadow
      g2.translate(2, 2);
      g2.setColor(new Color(0, 0, 0, 20));
      g2.fill(new Ellipse2D.Float(-2, -2, size + 4, size + 4));
      g2.setColor(new Color(0, 0, 0, 40));
      g2.fill(new Ellipse2D.Float(-1, -1, size + 2, size + 2));
      g2.setColor(new Color(0, 0, 0, 80));
      g2.fill(new Ellipse2D.Float(0, 0, size, size));
      g2.translate(-2, -2);
    }

    g2.drawImage(image, 0, 0, size, size, 0, 0, size, size, null);

    if (shape instanceof Rectangle) {
      Rectangle r = (Rectangle) shape;
      PaintUtils.drawBevel(g2, r);
    } else {
      g2.setColor(new Color(0, 0, 0, 120));
      g2.draw(shape);
    }

    g2.setColor(Color.white);
    g2.setStroke(new BasicStroke(1));
    g2.draw(new Ellipse2D.Float(point.x - 3, point.y - 3, 6, 6));
    g2.setColor(Color.black);
    g2.draw(new Ellipse2D.Float(point.x - 4, point.y - 4, 8, 8));

    g.translate(-imagePadding.left, -imagePadding.top);
  }
Esempio n. 25
0
  /**
   * Second Pass: We sweep through the layers from the bottom to the top and paint each one that is
   * marked as dirty
   *
   * <p>Note, that the painting for copied layers is done here to not hold the layers lock during
   * the painting.
   *
   * @param g The graphics object to use to paint this window.
   * @param refreshQ The custom queue which holds the set of refresh regions needing to be blitted
   *     to the screen
   */
  private void paintLayers(Graphics g, CGraphicsQ refreshQ) {
    if (CGraphicsQ.DEBUG) {
      System.err.println("[Paint dirty layers]");
    }

    for (int i = 0; i < dirtyCount; i++) {
      CLayer l = dirtyLayers[i];

      // Prepare relative dirty region coordinates
      // of the current layer
      int dx = l.dirtyBoundsCopy[X];
      int dy = l.dirtyBoundsCopy[Y];
      int dw = l.dirtyBoundsCopy[W];
      int dh = l.dirtyBoundsCopy[H];

      // Before we call into the layer to paint, we
      // translate the graphics context into the layer's
      // coordinate space
      g.translate(l.boundsCopy[X], l.boundsCopy[Y]);

      if (CGraphicsQ.DEBUG) {
        System.err.println("Painting Layer: " + l);
        System.err.println("\tClip: " + dx + ", " + dy + ", " + dw + ", " + dh);
      }

      // Clip the graphics to only contain the dirty region of
      // the layer (if the dirty region isn't set, clip to the
      // whole layer contents).
      g.clipRect(dx, dy, dw, dh);
      refreshQ.queueRefresh(l.boundsCopy[X] + dx, l.boundsCopy[Y] + dy, dw, dh);
      l.paint(g);

      // We restore our graphics context to prepare
      // for the next layer
      g.translate(-g.getTranslateX(), -g.getTranslateY());
      g.translate(tranX, tranY);

      // We reset our clip to this window's bounds again.
      g.setClip(bounds[X], bounds[Y], bounds[W], bounds[H]);

      g.setFont(font);
      g.setColor(color);
    } // for
  }
 public void paint(Graphics g) {
   putClientProperty("JTree.lineStyle", "None");
   Graphics g1 = g.create();
   g1.translate(0, -myVisibleRow * getRowHeight());
   super.paint(g1);
   g1.dispose();
   if (myBorder != null) {
     myBorder.paintBorder(this, g, 0, 0, myTreeTable.getWidth(), getRowHeight());
   }
 }
  /**
   * Paints container border. For grids the method also paints vertical and horizontal lines that
   * indicate bounds of the rows and columns. Method does nothing if the <code>component</code> is
   * not an instance of <code>RadContainer</code>.
   */
  private static void paintComponentBoundsImpl(
      final GuiEditor editor, @NotNull final RadComponent component, final Graphics g) {
    if (!(component instanceof RadContainer)
        && !(component instanceof RadNestedForm)
        && !component.isDragBorder()) {
      return;
    }

    boolean highlightBoundaries = (getDesignTimeInsets(component) > 2);

    if (component instanceof RadContainer && !component.isDragBorder()) {
      RadContainer container = (RadContainer) component;
      if (!highlightBoundaries
          && (container.getBorderTitle() != null || container.getBorderType() != BorderType.NONE)) {
        return;
      }
    }
    final Point point =
        SwingUtilities.convertPoint(
            component.getDelegee(), 0, 0, editor.getRootContainer().getDelegee());
    g.translate(point.x, point.y);
    try {
      if (component.isDragBorder()) {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setColor(LightColors.YELLOW);
        g2d.setStroke(new BasicStroke(2.0f));
        g2d.translate(1, 1);
      } else if (highlightBoundaries) {
        g.setColor(HIGHLIGHTED_BOUNDARY_COLOR);
      } else if (component.isSelected()) {
        g.setColor(SELECTED_BOUNDARY_COLOR);
      } else {
        g.setColor(NON_SELECTED_BOUNDARY_COLOR);
      }
      g.drawRect(0, 0, component.getWidth() - 1, component.getHeight() - 1);
      if (component.isDragBorder()) {
        g.translate(-1, -1);
      }
    } finally {
      g.translate(-point.x, -point.y);
    }
  }
Esempio n. 28
0
    /** Subclassed to translate the graphics such that the last visible row will be drawn at 0,0. */
    public void paint(Graphics g) {
      if (g == null) return;

      g.translate(0, -visibleRow * getRowHeight());

      try {
        super.paint(g);
      } catch (Throwable e) {
        logger.debug("random swing exception/error: ", e);
      }
    }
Esempio n. 29
0
  @Override
  public void render(Camera camera, GameContainer gameContainer) {
    Graphics graphics = gameContainer.getGraphics();
    graphics.pushTransform();
    graphics.translate(0, 40f);
    super.render(camera, gameContainer);
    graphics.popTransform();

    if (BattleToads.ALLOW_DEBUGGING) graphics.setColor(Color.magenta);
    if (BattleToads.ALLOW_DEBUGGING) graphics.draw(getCollisionHitbox(position));
  }
 private void print_current_chart(PrintJob pj) {
   Graphics page = pj.getGraphics();
   Dimension size = graph_panel.getSize();
   Dimension pagesize = pj.getPageDimension();
   main_graph.set_symbol(chart.current_tradable().toUpperCase());
   if (size.width <= pagesize.width) {
     // Center the output on the page.
     page.translate((pagesize.width - size.width) / 2, (pagesize.height - size.height) / 2);
   } else {
     // The graph size is wider than a page, so print first
     // the left side, then the right side.  Assumption - it is
     // not larger than two pages.
     page.translate(15, (pagesize.height - size.height) / 2);
     graph_panel.printAll(page);
     page.dispose();
     page = pj.getGraphics();
     page.translate(pagesize.width - size.width - 13, (pagesize.height - size.height) / 2);
   }
   graph_panel.printAll(page);
   page.dispose();
   main_graph.set_symbol(null);
 }