Esempio n. 1
0
  /** {@inheritDoc} */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setBackground(Color.white);
    int xDim = (int) (getWidth() / 56);
    int yDim = (int) (getHeight() / 66);
    g2d.drawLine(0, (agent[0].length) * yDim, Slope.getWidth() * xDim, (agent[0].length) * yDim);
    g2d.drawRect((Slope.getWidth() - 3) * xDim, 0, 15, Slope.getHeight() * yDim);

    for (int k = 0; k < Slope.getHeight(); k++)
      for (int l = 0; l < Slope.getWidth(); l++) {

        g2d.setColor(new Color(0, 0, 0, 1));
        g2d.drawRect(k * getWidth() / 56, l * getHeight() / 66, 30, 30);
      }

    for (int i = 0; i < agent.length; i++) {
      for (int j = 0; j < agent[0].length; j++) {
        g2d.setColor(Color.blue);
        if (agent[i][j]) {
          //					 g2d.drawString("*", i*getWidth()/56, j*getHeight()/66);
          g2d.drawImage(image, i * getWidth() / 56, j * getHeight() / 66, null);
        }
      }
    }
  }
Esempio n. 2
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);
   }
 }
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g.create();

    int width = getWidth();
    int height = getHeight();

    // rendering hints
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(
        RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    // formatter
    DecimalFormat format = new DecimalFormat("##.#%");
    // text to display
    String percentage =
        (value == null || Double.parseDouble(value.toString()) == -1)
            ? ""
            : format.format(Double.parseDouble(value.toString()));

    // paint text
    g2.setColor(Color.black);
    g2.setFont(g2.getFont().deriveFont(Font.BOLD));
    FontMetrics fontMetrics = g2.getFontMetrics();
    int textWidth = fontMetrics.stringWidth(percentage);
    int xPos = (width - textWidth) / 2;
    int yPos = height / 2 + fontMetrics.getDescent() + 2;
    g2.drawString(percentage, xPos, yPos);

    g2.dispose();
  }
  public void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setStroke(new BasicStroke(1.0f));

    if (isOpaque()) {
      g2d.setColor(getBackground());
      g2d.fillRect(0, 0, getWidth(), getHeight());
    }

    g2d.setColor(Color.black);
    g2d.drawLine(0, frameHeight / 2, frameWidth, frameHeight / 2);
    g2d.drawLine(frameWidth / 2, 0, frameWidth / 2, frameHeight);

    for (int i = unityX; i < frameWidth / 2; i += unityX) {
      g2d.drawLine(
          frameWidth / 2 + i, frameHeight / 2 - 3, frameWidth / 2 + i, frameHeight / 2 + 3);
      g2d.drawLine(
          frameWidth / 2 - i, frameHeight / 2 - 3, frameWidth / 2 - i, frameHeight / 2 + 3);
    }

    for (int i = unityY; i < frameHeight / 2; i += unityY) {
      g2d.drawLine(
          frameWidth / 2 - 3, frameHeight / 2 + i, frameWidth / 2 + 3, frameHeight / 2 + i);
      g2d.drawLine(
          frameWidth / 2 - 3, frameHeight / 2 - i, frameWidth / 2 + 3, frameHeight / 2 - i);
    }

    g2d.setColor(Color.blue);
    function.drawFunctionToGraphic(g2d, frameWidth, frameHeight, unityX, unityY);

    paintCurrentMethodState(g2d);

    g2d.dispose();
  }
Esempio n. 5
0
    public void paintComponent(Graphics g) {
      g.setColor(new Color(96, 96, 96));
      image.paintIcon(this, g, 1, 1);

      FontMetrics fm = g.getFontMetrics();

      String[] args = {jEdit.getVersion()};
      String version = jEdit.getProperty("about.version", args);
      g.drawString(version, (getWidth() - fm.stringWidth(version)) / 2, getHeight() - 5);

      g = g.create((getWidth() - maxWidth) / 2, TOP, maxWidth, getHeight() - TOP - BOTTOM);

      int height = fm.getHeight();
      int firstLine = scrollPosition / height;

      int firstLineOffset = height - scrollPosition % height;
      int lines = (getHeight() - TOP - BOTTOM) / height;

      int y = firstLineOffset;

      for (int i = 0; i <= lines; i++) {
        if (i + firstLine >= 0 && i + firstLine < text.size()) {
          String line = (String) text.get(i + firstLine);
          g.drawString(line, (maxWidth - fm.stringWidth(line)) / 2, y);
        }
        y += fm.getHeight();
      }
    }
Esempio n. 6
0
  /**
   * Draws a double headed arrow with arrow heads of a given width and height.
   *
   * @param aG the canvas to draw on;
   * @param aX1 the starting X position of the arrow;
   * @param aY1 the starting Y position of the arrow;
   * @param aX2 the ending X position of the arrow;
   * @param aY2 the ending Y position of the arrow;
   * @param aArrowWidth the total width of the arrow head;
   * @param aArrowHeight the total height of the arrow head.
   */
  public static final void drawDoubleHeadedArrow(
      final Graphics aG,
      final int aX1,
      final int aY1,
      final int aX2,
      final int aY2,
      final int aArrowWidth,
      final int aArrowHeight) {
    final Graphics2D g2d = (Graphics2D) aG.create();

    final int lineWidth = Math.abs(aX2 - aX1);
    final int threshold = (2 * aArrowWidth) + 2;
    try {
      int x1 = aX1;
      int x2 = aX2;

      if (lineWidth > threshold) {
        drawArrowHead(g2d, aX1, aY1, LEFT_FACING, aArrowWidth, aArrowHeight);
        // why x2 needs to be shifted by one pixel is beyond me...
        drawArrowHead(g2d, aX2 + 1, aY2, RIGHT_FACING, aArrowWidth, aArrowHeight);

        x1 += aArrowWidth - 1;
        x2 -= aArrowWidth + 1;
      }

      g2d.drawLine(x1, aY1, x2, aY2);
    } finally {
      g2d.dispose();
    }
  }
    @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);
        }
      }
    }
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    if (drawOverlay) {
      g = g.create();
      AntialiasingManager.activateAntialiasing(g);

      try {
        // Paint a roll over fade out.
        FadeTracker fadeTracker = FadeTracker.getInstance();

        float visibility = 0.0f;
        if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) {
          visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER);
          visibility /= 4;
        } else visibility = 0.5f;

        // Draw black overlay
        g.setColor(new Color(0.0f, 0.0f, 0.0f, visibility));
        g.fillRoundRect(1, 1, width - 2, height - 2, 10, 10);

        // Draw arrow
        g.setColor(Color.WHITE);

        int[] arrowX = new int[] {width - 17, width - 7, width - 12};
        int[] arrowY = new int[] {height - 12, height - 12, height - 7};
        g.fillPolygon(arrowX, arrowY, arrowX.length);
      } finally {
        g.dispose();
      }
    }
  }
Esempio n. 9
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    int centerX = getWidth() / 2;
    int centerY = getHeight() / 2;

    Graphics2D g2d = (Graphics2D) g.create();

    g2d.translate(centerX, centerY); // Set Graphics2D transform origin to center of panel

    g2d.setColor(fgColor);
    bar.setFrame(-barWidth / 2, -barHeight / 2 + barHeight * barPosition, barWidth, barHeight);
    g2d.fill(bar);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    for (Spike spike : spikes) {
      if (spike != null) {
        double opacity = 255;
        if (spike.getDirection() == 0) {
          opacity = getWidth() * 0.5 - 70 - spike.getPosition().getX();
        } else {
          opacity = spike.getPosition().getX() + getWidth() * 0.5 - 70;
        }
        g2d.setColor(new Color(0, 0, 0, (int) clamp(opacity * 10, 0, 255)));
        g2d.fill(spike);
      }
    }
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g2d.setColor(Color.BLACK);
    g2d.draw(barCross);
    g2d.setStroke(new BasicStroke(2));
    g2d.draw(barFrame);
    g2d.dispose();
  }
    @Override
    public void paintComponent(final Graphics g) {

      Graphics2D g2d = (Graphics2D) g.create();

      Dimension srcSize = image.getSizeForPaint(g2d);
      int wSrc = srcSize.width;
      int hSrc = srcSize.height;

      int wImg = getPreferredSize().width;
      int hImg = getPreferredSize().height;

      int xOffset = (getSize().width - wImg) / 2;

      RenderingHints hints =
          new RenderingHints(
              RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
      g2d.setRenderingHints(hints);

      FSkin.drawImage(
          g2d,
          image,
          xOffset,
          0,
          wImg + xOffset,
          hImg, // Destination
          0,
          0,
          wSrc,
          hSrc); // Source

      g2d.dispose();
    }
  /*
   * (non-Javadoc)
   *
   * @seeorg.jvnet.flamingo.common.ui.BasicCommandButtonUI#
   * paintButtonVerticalSeparator(java.awt.Graphics, int)
   */
  @Override
  protected void paintButtonVerticalSeparator(Graphics graphics, Rectangle separatorArea) {
    Graphics2D g2d = (Graphics2D) graphics.create();
    g2d.translate(separatorArea.x, 0);

    SubstanceColorScheme colorScheme =
        SubstanceColorSchemeUtilities.getColorScheme(
            this.commandButton,
            ColorSchemeAssociationKind.SEPARATOR,
            ComponentState.getState(this.commandButton.getActionModel(), this.commandButton));

    float fadeAlpha = this.getSeparatorAlpha();
    g2d.setComposite(AlphaComposite.SrcOver.derive(fadeAlpha));

    SeparatorPainterUtils.paintSeparator(
        this.commandButton,
        g2d,
        colorScheme,
        1,
        this.commandButton.getHeight(),
        JSlider.VERTICAL,
        true,
        4,
        4,
        true);

    g2d.dispose();
  }
  @Override
  protected void paintBackground(Graphics g, JComponent component) {
    getGlassParameters();
    Graphics2D g2d = (Graphics2D) g.create();

    if (getOrientation().isHorizontal()) {
      paintBackground(
          g2d,
          0,
          0,
          component.getWidth(),
          component.getHeight(),
          getOrientation().isHorizontal(),
          component);
    } else {
      paintBackground(
          g2d,
          0,
          0,
          component.getHeight(),
          component.getWidth(),
          getOrientation().isHorizontal(),
          component);
    }

    g2d.dispose();
  }
Esempio n. 13
0
  @SuppressWarnings("deprecation")
  public final void runOneComponent(
      Component comp, Rectangle bounds, Graphics g, Shape clip, int weightFlags) {
    if (comp == null || comp.getPeer() == null || !comp.isVisible()) {
      return;
    }
    boolean lightweight = comp.isLightweight();
    if ((lightweight && (weightFlags & LIGHTWEIGHTS) == 0)
        || (!lightweight && (weightFlags & HEAVYWEIGHTS) == 0)) {
      return;
    }

    if (bounds == null) {
      bounds = comp.getBounds();
    }

    if (clip == null || clip.intersects(bounds)) {
      Graphics cg = g.create();
      try {
        constrainGraphics(cg, bounds);
        cg.setFont(comp.getFont());
        cg.setColor(comp.getForeground());
        if (cg instanceof Graphics2D) {
          ((Graphics2D) cg).setBackground(comp.getBackground());
        } else if (cg instanceof Graphics2Delegate) {
          ((Graphics2Delegate) cg).setBackground(comp.getBackground());
        }
        run(comp, cg);
      } finally {
        cg.dispose();
      }
    }
  }
  public static void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    g = g.create(x, y, width, height);
    // corners
    TL.paintIcon(c, g, x, y);
    BL.paintIcon(c, g, x, y + height - BL.getIconHeight());
    TR.paintIcon(c, g, x + width - TR.getIconWidth(), y);
    BR.paintIcon(c, g, x + width - BR.getIconWidth(), y + height - BR.getIconHeight());

    // top and bottom lines
    int xOffset = x + TL.getIconWidth();
    int stop = x + width - TR.getIconWidth();
    int top = y;
    int bottom = y + height - B.getIconHeight();
    g.setClip(xOffset, y, width - L.getIconWidth() - R.getIconWidth(), height);
    while (xOffset < stop) {
      T.paintIcon(c, g, xOffset, top);
      B.paintIcon(c, g, xOffset, bottom);
      xOffset += T.getIconWidth();
    }

    // left and right lines
    int left = x;
    int right = x + width - R.getIconWidth();
    int yOffset = y + T.getIconHeight();
    stop = y + height - B.getIconHeight();
    g.setClip(x, yOffset, width, height - T.getIconHeight() - B.getIconHeight());
    while (yOffset < stop) {
      L.paintIcon(c, g, left, yOffset);
      R.paintIcon(c, g, right, yOffset);
      yOffset += L.getIconHeight();
    }
    g.dispose();
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.jvnet.flamingo.common.ui.BasicCommandButtonUI#paintButtonBackground
   * (java.awt.Graphics, java.awt.Rectangle)
   */
  @Override
  protected void paintButtonBackground(Graphics graphics, Rectangle toFill) {
    if (SubstanceCoreUtilities.isButtonNeverPainted(this.commandButton)) return;

    ButtonModel actionModel = this.commandButton.getActionModel();
    PopupButtonModel popupModel = ((JCommandButton) this.commandButton).getPopupModel();
    Rectangle actionArea = this.getLayoutInfo().actionClickArea;
    Rectangle popupArea = this.getLayoutInfo().popupClickArea;

    BufferedImage fullAlphaBackground =
        CommandButtonBackgroundDelegate.getCombinedCommandButtonBackground(
            this.commandButton, actionModel, actionArea, popupModel, popupArea);

    // Two special cases here:
    // 1. Button has flat appearance and doesn't show the popup
    // 2. Button is disabled.
    // For both cases, we need to set custom translucency.
    boolean isFlat =
        this.commandButton.isFlat()
            && !((JCommandButton) this.commandButton).getPopupModel().isPopupShowing();
    boolean isSpecial = isFlat || !this.commandButton.isEnabled();
    float extraAlpha = 1.0f;
    if (isSpecial) {
      if (isFlat) {
        float extraActionAlpha = 0.0f;
        for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry :
            getActionTransitionTracker().getModelStateInfo().getStateContributionMap().entrySet()) {
          ComponentState activeState = activeEntry.getKey();
          if (activeState.isDisabled()) continue;
          if (activeState == ComponentState.ENABLED) continue;
          extraActionAlpha += activeEntry.getValue().getContribution();
        }
        float extraPopupAlpha = 0.0f;
        for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry :
            getPopupTransitionTracker().getModelStateInfo().getStateContributionMap().entrySet()) {
          ComponentState activeState = activeEntry.getKey();
          if (activeState.isDisabled()) continue;
          if (activeState == ComponentState.ENABLED) continue;
          extraPopupAlpha += activeEntry.getValue().getContribution();
        }
        extraAlpha = Math.max(extraActionAlpha, extraPopupAlpha);
      } else {
        ComponentState actionAreaState = ComponentState.getState(actionModel, this.commandButton);
        if (actionAreaState.isDisabled()) {
          extraAlpha = SubstanceColorSchemeUtilities.getAlpha(this.commandButton, actionAreaState);
        }
      }
    }
    // System.out.println(extraAlpha);
    extraAlpha = Math.min(1.0f, extraAlpha);
    if (extraAlpha > 0.0f) {
      Graphics2D g2d = (Graphics2D) graphics.create();
      g2d.setComposite(
          LafWidgetUtilities.getAlphaComposite(this.commandButton, extraAlpha, graphics));
      g2d.drawImage(fullAlphaBackground, 0, 0, null);
      g2d.dispose();
    }
  }
Esempio n. 16
0
 /**
  * Paint a background for all groups and a round blue border and background when a cell is
  * selected.
  *
  * @param g the <tt>Graphics</tt> object
  */
 public void paintComponent(Graphics g) {
   Graphics g2 = g.create();
   try {
     internalPaintComponent(g2);
   } finally {
     g2.dispose();
   }
   super.paintComponent(g);
 }
Esempio n. 17
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Graphics2D g2 = (Graphics2D) g.create();
   g2.translate(x, y);
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   g2.setPaint(Color.ORANGE);
   g2.fill(star);
   g2.dispose();
 }
Esempio n. 18
0
 @Override
 protected void paintComponent(Graphics g) {
   BufferedImage image = theImage.getImage();
   if (image != null) {
     Graphics2D gg = (Graphics2D) g.create();
     overlay.paint(gg, image, theImage.getImageTransform());
     gg.dispose();
   }
 }
Esempio n. 19
0
 @Override
 public void paint(Graphics g) {
   Dimension size = getSize();
   Graphics2D g2 = (Graphics2D) g.create();
   g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f));
   g2.fillRect(0, 0, (int) size.getWidth(), (int) size.getHeight());
   super.paint(g2);
   g2.dispose();
 }
 @Override
 protected void paintTabBackground(
     Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) {
   g = g.create();
   try {
     internalPaintTabBackground(g, tabPlacement, tabIndex, x, y, w, h, isSelected);
   } finally {
     g.dispose();
   }
 }
Esempio n. 21
0
 public void paintImage(Graphics g) {
   final Rectangle b = getBounds();
   final Graphics lG = g.create(b.x, b.y, b.width, b.height);
   try {
     lG.setColor(Color.red);
     doPaint(lG);
   } finally {
     lG.dispose();
   }
 }
Esempio n. 22
0
 @Override
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   Graphics2D g2 = (Graphics2D) g.create();
   g2.translate(x, y);
   g2.setPaint(borderSelectionColor);
   g2.drawRect(0, 0, w - 1, h - 1);
   g2.setPaint(getLineColor());
   BasicGraphicsUtils.drawDashedRect(g2, 0, 0, w, h);
   g2.dispose();
 }
 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());
   }
 }
Esempio n. 24
0
  /** Overrides <code>Graphics.create</code> to return a DebugGraphics object. */
  public Graphics create() {
    DebugGraphics debugGraphics;

    debugGraphics = new DebugGraphics();
    debugGraphics.graphics = graphics.create();
    debugGraphics.debugOptions = debugOptions;
    debugGraphics.buffer = buffer;

    return debugGraphics;
  }
Esempio n. 25
0
  /**
   * Overrides the <code>paintComponent</code> method of <tt>JButton</tt> to paint the button
   * background and icon, and all additional effects of this configurable button.
   *
   * @param g The Graphics object.
   */
  @Override
  protected void paintComponent(Graphics g) {
    Graphics2D g1 = (Graphics2D) g.create();
    try {
      internalPaintComponent(g1);
    } finally {
      g1.dispose();
    }

    super.paintComponent(g);
  }
Esempio n. 26
0
  /**
   * Paint a background for all groups and a round blue border and background when a cell is
   * selected.
   *
   * @param g the <tt>Graphics</tt> object used for painting
   */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    g = g.create();
    try {
      internalPaintComponent(g);
    } finally {
      g.dispose();
    }
  }
Esempio n. 27
0
  /**
   * This paints the entire plot. It calls the draw methods of all the attached axis and data sets.
   * The order of drawing is - Axis first, data legends next, data last.
   *
   * @params g Graphics state.
   */
  public void paint(Graphics g) {
    int i;
    Graphics lg = g.create();
    Rectangle r = bounds();

    /* The r.x and r.y returned from bounds is relative to the
     ** parents space so set them equal to zero.
     */
    r.x = 0;
    r.y = 0;

    if (DefaultBackground == null) DefaultBackground = this.getBackground();
    if (DataBackground == null) DataBackground = this.getBackground();

    //        System.out.println("Graph2D paint method called!");

    if (!paintAll) return;

    r.x += borderLeft;
    r.y += borderTop;
    r.width -= borderLeft + borderRight;
    r.height -= borderBottom + borderTop;

    paintFirst(lg, r);

    if (!axis.isEmpty()) r = drawAxis(lg, r);
    else {
      if (clearAll) {
        Color c = g.getColor();
        g.setColor(DataBackground);
        g.fillRect(r.x, r.y, r.width, r.height);
        g.setColor(c);
      }
      drawFrame(lg, r.x, r.y, r.width, r.height);
    }

    paintBeforeData(lg, r);

    if (!dataset.isEmpty()) {

      datarect.x = r.x;
      datarect.y = r.y;
      datarect.width = r.width;
      datarect.height = r.height;

      for (i = 0; i < dataset.size(); i++) {
        ((DataSet) dataset.elementAt(i)).draw_data(lg, r);
      }
    }

    paintLast(lg, r);

    lg.dispose();
  }
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g.create();
   int offset = 0;
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   g2.setRenderingHint(
       RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
   g2.drawString(ptmString.getIterator(), offset, 15);
   g2.dispose();
 }
Esempio n. 29
0
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g.create();

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setColor(color);
    g2.fillOval(0, 0, getWidth(), getHeight());
    g2.dispose();
  }
Esempio n. 30
0
  /**
   * Draws the "Round Disabled Border" which is used throughout the SIPComm L&F.
   *
   * @param g the <tt>Graphics</tt> object used for painting
   * @param x the x coordinate to start the border
   * @param y the y coordinate to start the border
   * @param w the width of the border
   * @param h the height of the border
   * @param r1 the arc width
   * @param r2 the arc height
   */
  static void drawRoundDisabledBorder(Graphics g, int x, int y, int w, int h, int r1, int r2) {
    AntialiasingManager.activateAntialiasing(g);
    Graphics2D g2 = (Graphics2D) g.create();
    try {
      g2.setColor(SIPCommLookAndFeel.getControlShadow());

      g2.drawRoundRect(0, 0, w - 1, h - 1, r1, r2);
    } finally {
      g.dispose();
    }
  }