public static void smoothFillInverseHorGradient(
     Graphics g, Color[] colors, int x, int y, int w, int h) {
   if (colors != null) {
     Graphics2D g2D = (Graphics2D) g;
     Paint savedPaint = g2D.getPaint();
     int steps = colors.length;
     double dy = (double) h / (double) steps;
     int y1 = y;
     for (int i = 0; i < steps; i++) {
       int y2 = y + (int) Math.round((double) i * dy);
       g.setColor(colors[colors.length - i - 1]);
       if (i == (steps - 1)) {
         g2D.setPaint(null);
         g2D.setColor(colors[colors.length - i - 1]);
         g.fillRect(x, y1, w, y + h - y1);
       } else {
         g2D.setPaint(
             new GradientPaint(
                 0, y1, colors[colors.length - i - 1], 0, y2, colors[colors.length - i - 2]));
         g.fillRect(x, y1, w, y2 - y1);
       }
       y1 = y2;
     }
     g2D.setPaint(savedPaint);
   }
 }
 public Image getScreenshot() {
   BufferedImage image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_4BYTE_ABGR);
   Graphics g = image.getGraphics();
   paint(g);
   g.dispose();
   return image;
 }
Пример #3
0
  // ------------------------------------------------------------------------
  // SCREEN PAINTER
  // Put some function here to paint whatever you want over the screen before and after
  // all edges and nodes have been painted.
  public void PaintScreenBefore(Graphics g) {

    Dimension d = MainClass.mainFrame.GetGraphDisplayPanel().getSize();
    NodeInfo nodeInfo;
    int x = 0;
    int y = 0;
    int step = 10;

    for (; x < d.width; x += step) {
      for (y = 0; y < d.height; y += step) {
        double val = 0;
        double sum = 0;
        double total = 0;
        double min = 10000000;
        for (Enumeration nodes = proprietaryNodeInfo.elements(); nodes.hasMoreElements(); ) {
          nodeInfo = (NodeInfo) nodes.nextElement();
          double dist = distance(x, y, nodeInfo.centerX, nodeInfo.centerY);
          if (nodeInfo.value != -1 && nodeInfo.nodeNumber.intValue() != 1) { // 121
            if (dist < min) min = dist;
            val += ((double) nodeInfo.value) / dist / dist;
            sum += (1 / dist / dist);
          }
        }
        int reading = (int) (val / sum);
        reading = reading >> 2;
        if (reading > 255) reading = 255;
        g.setColor(new Color(reading, reading, reading));
        g.fillRect(x, y, step, step);
      }
    }
  }
Пример #4
0
 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
   JMenuItem b = (JMenuItem) c;
   ButtonModel model = b.getModel();
   Color borderColorLo = AbstractLookAndFeel.getFrameColor();
   Color borderColorHi =
       ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40);
   if (c.getParent() instanceof JMenuBar) {
     if (model.isArmed() || model.isSelected()) {
       g.setColor(borderColorLo);
       g.drawLine(x, y, x + w - 1, y);
       g.drawLine(x, y, x, y + h - 1);
       g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
       g.setColor(borderColorHi);
       g.drawLine(x + 1, y + 1, x + w - 2, y + 1);
       g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
     }
   } else {
     if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
       g.setColor(borderColorLo);
       g.drawLine(x, y, x + w - 1, y);
       g.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
       g.setColor(borderColorHi);
       g.drawLine(x, y + 1, x + w - 2, y + 1);
     }
   }
 }
  private void drawColorBar(Graphics g) {
    int minimum, maximum, height;

    minimum = 100;
    maximum = 500;
    height = 1;
    int finalI = 0;

    for (int i = 0; i < (maximum - minimum); i++) {
      float f = 0.75f * i / (float) (maximum - minimum);
      g.setColor(Color.getHSBColor(0.75f - f, 1.0f, 1.0f));
      g.fillRect(getWidth() - 40, height * i + 50, 20, height);
      finalI = i;
    }

    g.setColor(Color.BLACK);
    g.drawString(
        String.valueOf(this.opticalReturnPowerController.getMaxValue()),
        getWidth() - 60,
        48); // Max Value
    g.drawString(
        String.valueOf(this.opticalReturnPowerController.getMinValue()),
        getWidth() - 60,
        finalI + 63); // Min Value
  }
  public void paintPalette(Graphics g) {
    boolean leftToRight = MetalUtils.isLeftToRight(frame);

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

    if (paletteBumps == null) {
      paletteBumps =
          new MetalBumps(
              0,
              0,
              MetalLookAndFeel.getPrimaryControlHighlight(),
              MetalLookAndFeel.getPrimaryControlInfo(),
              MetalLookAndFeel.getPrimaryControlShadow());
    }

    Color background = MetalLookAndFeel.getPrimaryControlShadow();
    Color darkShadow = MetalLookAndFeel.getPrimaryControlDarkShadow();

    g.setColor(background);
    g.fillRect(0, 0, width, height);

    g.setColor(darkShadow);
    g.drawLine(0, height - 1, width, height - 1);

    int xOffset = leftToRight ? 4 : buttonsWidth + 4;
    int bumpLength = width - buttonsWidth - 2 * 4;
    int bumpHeight = getHeight() - 4;
    paletteBumps.setBumpArea(bumpLength, bumpHeight);
    paletteBumps.paintIcon(this, g, xOffset, 2);
  }
Пример #7
0
  @Override
  public void paintDeterminate(Graphics g, JComponent c) {
    Insets b = progressBar.getInsets(); // area for border
    int barRectWidth = progressBar.getWidth() - b.right - b.left;
    int barRectHeight = progressBar.getHeight() - b.top - b.bottom;
    if (barRectWidth <= 0 || barRectHeight <= 0) {
      return;
    }
    // int cellLength = getCellLength();
    // int cellSpacing = getCellSpacing();
    // amount of progress to draw
    int amountFull = getAmountFull(b, barRectWidth, barRectHeight);

    // draw the cells
    if (progressBar.getOrientation() == SwingConstants.HORIZONTAL) {
      float x = amountFull / (float) barRectWidth;
      g.setColor(getColorFromPallet(pallet, x));
      g.fillRect(b.left, b.top, amountFull, barRectHeight);
    } else { // VERTICAL
      float y = amountFull / (float) barRectHeight;
      g.setColor(getColorFromPallet(pallet, y));
      g.fillRect(b.left, barRectHeight + b.bottom - amountFull, barRectWidth, amountFull);
    }
    // Deal with possible text painting
    if (progressBar.isStringPainted()) {
      paintString(g, b.left, b.top, barRectWidth, barRectHeight, amountFull, b);
    }
  }
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (uneHashtable.get(unEtat) != null) {
     g.setColor((Color) uneHashtable.get(unEtat));
     g.fillRect(100, 20, 40, 40);
   }
 }
Пример #9
0
  public void paint(Graphics gg) {
    int faceSize = Math.min(getWidth() - 4, getHeight() - 4);
    if (face == null)
      face =
          new PADFaceMapped(
              Math.max(2, (getWidth() - faceSize) / 2),
              Math.max(2, (getHeight() - faceSize) / 2),
              faceSize);
    if (buffer == null) {
      im = this.createImage(getWidth(), getHeight());
      buffer = im.getGraphics();
    }
    super.paint(buffer);

    buffer.setColor(new Color(255, 255, 255, 0));
    buffer.fillRect(0, 0, im.getWidth(null), im.getHeight(null));

    face.setDimensions(
        Math.max(2, (getWidth() - faceSize) / 2),
        Math.max(2, (getHeight() - faceSize) / 2),
        faceSize);
    face.paint(buffer);

    // draw buffer to screen
    gg.drawImage(im, 0, 0, null, null);
  }
Пример #10
0
    @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);
        }
      }
    }
Пример #11
0
  /** Wartet auf einen Mausklick und gibt die Koordinaten von diesem zurück. */
  @SneakyThrows
  private Point getMouseClick() {
    if (mouseAdapter == null) {
      mouseAdapter =
          new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
              synchronized (ScenePane.this) {
                lastClick = new Point(e.getX(), e.getY());
                ScenePane.this.notifyAll();
              }
            }
          };
      addMouseListener(mouseAdapter);
    }

    synchronized (this) {
      lastClick = null;
      while (lastClick == null) {
        wait();
      }
      Graphics g = getGraphics();
      g.setColor(Color.CYAN);
      g.fillOval(lastClick.x - 5, lastClick.y - 5, 11, 11);
      return lastClick;
    }
  }
Пример #12
0
  /**
   * The paintComponent() method copies the off-screen canvas to the screen (first creating it, if
   * necessary). If a mouse drag is is progress, then the current tool is not Tool.CURVE, then the
   * shape that the user is drawing is drawn over the off-screen canvas. (This is to avoid making
   * the shape a permanent part of the picture until after the user releases the mouse. The effect
   * is a "rubber band cursor" in which the shape changes as the user drags the mouse, but the
   * picture under the shape is not affected.)
   */
  @Override
  public void paintComponent(Graphics g) {

    /* First create the off-screen canvas, if it does not already exist. */

    if (OSC == null) {
      createOSC();
    }

    /* Copy the off-screen canvas to the panel.  Since we know that the
    image is already completely available, the fourth "ImageObserver"
    parameter to g.drawImage() can be null.  Since the canvas completely
    fills the panel, there is no need to call super.paintComponent(g). */

    g.drawImage(OSC, 0, 0, null);

    /* If the user is currently dragging the mouse to draw a line, oval,
    or rectangle, draw the shape on top the image from the off-screen
    canvas, using the current drawing color.  (This is not done if the
    user is drawing a curve or using the smudge tool.) */

    if (dragging && SHAPE_TOOLS.contains(currentTool)) {
      g.setColor(currentColor);
      putCurrentShape(g);
    }
  }
Пример #13
0
  private void gameRender() {
    if (dbImage == null) {
      dbImage = createImage(PWIDTH, PHEIGHT);
      if (dbImage == null) {
        System.out.println("dbImage is null");
        return;
      } else dbg = dbImage.getGraphics();
    }

    // draw a white background
    dbg.setColor(Color.white);
    dbg.fillRect(0, 0, PWIDTH, PHEIGHT);

    // draw the game elements: order is important
    ribsMan.display(dbg); // the background ribbons
    bricksMan.display(dbg); // the bricks
    jack.drawSprite(dbg); // the sprites
    fireball.drawSprite(dbg);

    if (showExplosion) // draw the explosion (in front of jack)
    dbg.drawImage(explosionPlayer.getCurrentImage(), xExpl, yExpl, null);

    reportStats(dbg);

    if (gameOver) gameOverMessage(dbg);

    if (showHelp) // draw the help at the very front (if switched on)
    dbg.drawImage(
          helpIm, (PWIDTH - helpIm.getWidth()) / 2, (PHEIGHT - helpIm.getHeight()) / 2, null);
  } // end of gameRender()
Пример #14
0
  public void paint(Graphics g) {
    g.drawImage(Title, 450, 100, this);
    g.setFont(new Font("TimesRoman", Font.BOLD, 24));
    g.setColor(new Color(0x660033));

    setIconImage(icon);
  }
Пример #15
0
 public void paint(Graphics g) {
   MetalBumps usedBumps;
   if (splitPane.hasFocus()) {
     usedBumps = focusBumps;
     g.setColor(primaryControlColor);
   } else {
     usedBumps = bumps;
     g.setColor(controlColor);
   }
   Rectangle clip = g.getClipBounds();
   Insets insets = getInsets();
   g.fillRect(clip.x, clip.y, clip.width, clip.height);
   Dimension size = getSize();
   size.width -= inset * 2;
   size.height -= inset * 2;
   int drawX = inset;
   int drawY = inset;
   if (insets != null) {
     size.width -= (insets.left + insets.right);
     size.height -= (insets.top + insets.bottom);
     drawX += insets.left;
     drawY += insets.top;
   }
   usedBumps.setBumpArea(size);
   usedBumps.paintIcon(this, g, drawX, drawY);
   super.paint(g);
 }
 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);
   }
 }
Пример #17
0
    public void paint(Graphics g) {
      Dimension dim = getSize();

      g.draw3DRect(1, 1, dim.width - 3, dim.height - 3, true);
      g.setColor(Color.black);
      g.drawRect(0, 0, dim.width - 1, dim.height - 1);
    }
 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);
   }
 }
Пример #19
0
 public void paintComponent(Graphics g) {
   g.setColor(new Color(0x8090ff));
   g.fillRect(0, 0, level.length * 16, level.height * 16);
   levelRenderer.render(g, 0);
   g.setColor(Color.BLACK);
   g.drawRect(xTile * 16 - 1, yTile * 16 - 1, 17, 17);
 }
Пример #20
0
 public void drawTo(Graphics g, Line line) {
   if (!calc.tileOnMap(t1) || !calc.tileOnMap(t2)) return;
   if (calc.tileOnMap(line.getTile1()) && calc.tileOnMap(line.getTile2())) {
     Point p1 = calc.tileToMinimap(t1);
     Point p2 = calc.tileToMinimap(t2);
     Point p3 = calc.tileToMinimap(line.getTile2());
     Point p4 = calc.tileToMinimap(line.getTile1());
     GeneralPath path = new GeneralPath();
     path.moveTo(p1.x, p1.y);
     path.lineTo(p2.x, p2.y);
     path.lineTo(p3.x, p3.y);
     path.lineTo(p4.x, p4.y);
     path.closePath();
     g.setColor(POLY_FILL);
     ((Graphics2D) g).fill(path);
     ((Graphics2D) g).draw(path);
   }
   Point last = null, p;
   g.setColor(Color.ORANGE);
   for (RSTile t : pathList) {
     if (calc.tileOnMap(t)) {
       p = calc.tileToMinimap(t);
       g.fillOval(p.x - 2, p.y - 2, 5, 5);
       if (last != null) g.drawLine(p.x, p.y, last.x, last.y);
       last = p;
     } else last = null;
   }
 }
    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);
    }
Пример #22
0
 protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) {
   JMenuItem b = (JMenuItem) c;
   ButtonModel model = b.getModel();
   if (c.getParent() instanceof JMenuBar) {
     if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
       g.setColor(AbstractLookAndFeel.getMenuSelectionBackgroundColor());
       g.fillRect(x, y, w, h);
     }
   } else {
     if (model.isArmed() || (c instanceof JMenu && model.isSelected())) {
       g.setColor(AbstractLookAndFeel.getMenuSelectionBackgroundColor());
       g.fillRect(x, y, w, h);
     } else if (!AbstractLookAndFeel.getTheme().isMenuOpaque()) {
       Graphics2D g2D = (Graphics2D) g;
       Composite composite = g2D.getComposite();
       AlphaComposite alpha =
           AlphaComposite.getInstance(
               AlphaComposite.SRC_OVER, AbstractLookAndFeel.getTheme().getMenuAlpha());
       g2D.setComposite(alpha);
       g.setColor(AbstractLookAndFeel.getMenuBackgroundColor());
       g.fillRect(x, y, w, h);
       g2D.setComposite(composite);
     } else {
       g.setColor(AbstractLookAndFeel.getMenuBackgroundColor());
       g.fillRect(x, y, w, h);
     }
   }
   if (menuItem.isSelected() && menuItem.isArmed()) {
     g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
   } else {
     g.setColor(AbstractLookAndFeel.getMenuForegroundColor());
   }
 }
Пример #23
0
 public void paintThumb(Graphics g) {
   Icon icon = null;
   if (slider.getOrientation() == JSlider.HORIZONTAL) {
     if (isRollover && slider.isEnabled()) {
       icon = getThumbHorIconRollover();
     } else {
       icon = getThumbHorIcon();
     }
   } else {
     if (isRollover && slider.isEnabled()) {
       icon = getThumbVerIconRollover();
     } else {
       icon = getThumbVerIcon();
     }
   }
   Graphics2D g2D = (Graphics2D) g;
   Composite savedComposite = g2D.getComposite();
   if (!slider.isEnabled()) {
     g.setColor(AbstractLookAndFeel.getBackgroundColor());
     g.fillRect(thumbRect.x + 1, thumbRect.y + 1, thumbRect.width - 2, thumbRect.height - 2);
     AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f);
     g2D.setComposite(alpha);
   }
   icon.paintIcon(null, g, thumbRect.x, thumbRect.y);
   g2D.setComposite(savedComposite);
 }
Пример #24
0
 @Override
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.setColor(color);
   g.drawLine(0, 0, getWidth(), getHeight());
   g.drawLine(getWidth(), 0, 0, getHeight());
 }
 // Show a message over frozen image in the display
 public void showMessage(String message) {
   Graphics g = getGraphics();
   g.setColor(Color.black);
   g.fillRect(30, (getHeight() / 2) - 16, message.length() * 10, 25);
   g.setColor(Color.white);
   g.drawString(message, 40, getHeight() / 2);
 }
Пример #26
0
 public void actionPerformed(ActionEvent evt) {
   graph.setColor(Color.cyan);
   graph.fillRect(0, 0, SIZE.width, SIZE.height);
   bar.draw(graph);
   for (int i = 0; i < balls.length; i++) balls[i].draw(graph);
   repaint();
 }
 protected void paintText(Graphics g, JComponent com, Rectangle rect, String s) {
   JButtonLinkA bn = (JButtonLinkA) com;
   ButtonModel bnModel = bn.getModel();
   Color color = bn.getForeground();
   Object obj = null;
   if (bnModel.isEnabled()) {
     if (bnModel.isPressed()) bn.setForeground(bn.getActiveLinkColor());
     else if (bn.isLinkVisited()) bn.setForeground(bn.getVisitedLinkColor());
     else bn.setForeground(bn.getLinkColor());
   } else {
     if (bn.getDisabledLinkColor() != null) bn.setForeground(bn.getDisabledLinkColor());
   }
   super.paintText(g, com, rect, s);
   int behaviour = bn.getLinkBehavior();
   boolean drawLine = false;
   if (behaviour == JButtonLinkA.HOVER_UNDERLINE) {
     if (bnModel.isRollover()) drawLine = true;
   } else if (behaviour == JButtonLinkA.ALWAYS_UNDERLINE
       || behaviour == JButtonLinkA.SYSTEM_DEFAULT) drawLine = true;
   if (!drawLine) return;
   FontMetrics fm = g.getFontMetrics();
   int x = rect.x + getTextShiftOffset();
   int y = (rect.y + fm.getAscent() + fm.getDescent() + getTextShiftOffset()) - 1;
   if (bnModel.isEnabled()) {
     g.setColor(bn.getForeground());
     g.drawLine(x, y, (x + rect.width) - 1, y);
   } else {
     g.setColor(bn.getBackground().brighter());
     g.drawLine(x, y, (x + rect.width) - 1, y);
   }
 }
Пример #28
0
 protected void paintComponent(Graphics g) {
   Dimension size = this.getSize();
   int x = 0;
   int y = 0;
   g.setColor(new Color((int) seq1, (int) seq2, (int) seq3));
   g.fillRect(x, y, size.width, size.height);
 }
Пример #29
0
  private void drawAxes(Graphics g) {
    g.drawLine(padding, height, width + padding, height);
    g.drawLine(padding, 0, padding, height);

    g.drawString("time", padding + width / 2, height + padding - 5);
    g.drawString("pop", 5, height / 2);
  }
Пример #30
0
 public static void drawString(JComponent c, Graphics g, String text, int x, int y) {
   Graphics2D g2D = (Graphics2D) g;
   Object savedRenderingHint = null;
   if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
     savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
     g2D.setRenderingHint(
         RenderingHints.KEY_TEXT_ANTIALIASING,
         AbstractLookAndFeel.getTheme().getTextAntiAliasingHint());
   }
   if (getJavaVersion() >= 1.6) {
     try {
       Class swingUtilities2Class = Class.forName("sun.swing.SwingUtilities2");
       Class classParams[] = {
         JComponent.class, Graphics.class, String.class, Integer.TYPE, Integer.TYPE
       };
       Method m = swingUtilities2Class.getMethod("drawString", classParams);
       Object methodParams[] = {c, g, text, new Integer(x), new Integer(y)};
       m.invoke(null, methodParams);
     } catch (Exception ex) {
       g.drawString(text, x, y);
     }
   } else {
     g.drawString(text, x, y);
   }
   if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
     g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint);
   }
 }