Examples of FontMetrics


Examples of ae.java.awt.FontMetrics

    public FontMetrics getFontMetrics(Font font) {
        if ((this.fontMetrics != null) && (font == this.font)) {
            return this.fontMetrics;
        }
        FontMetrics fm =
          FontDesignMetrics.getMetrics(font, getFontRenderContext());

        if (this.font == font) {
            this.fontMetrics = fm;
        }
View Full Code Here

Examples of com.google.code.appengine.awt.FontMetrics

            if(iter.getIndex() == iter.getRunStart())
            {
                if(stringbuffer.length() > 0)
                {
                    drawString(stringbuffer.toString(), x, y);
                    FontMetrics fontmetrics = getFontMetrics();
                    x = (float)((double)x + fontmetrics.getStringBounds(stringbuffer.toString(), this).getWidth());
                    stringbuffer.delete(0, stringbuffer.length());
                }
                doAttributes(iter);
            }
            stringbuffer.append(c);
View Full Code Here

Examples of com.jgraph.gaeawt.java.awt.FontMetrics

  @SuppressWarnings("deprecation")
  @Override
  public FontMetrics getFontMetrics(Font font)
  {
    FontMetrics fm;
    for (FontMetrics element : cacheFM)
    {
      fm = element;
      if (fm == null)
      {
        break;
      }

      if (fm.getFont().equals(font))
      {
        return fm;
      }
    }
    fm = new FontMetricsImpl(font);
View Full Code Here

Examples of java.awt.FontMetrics

    grp.setClip(clipBounds);

    // Paint the copyright notices
    grp.setColor(Settings.propProgramPanelForegroundColor.getColor());
    Channel[] channelArr = mModel.getShownChannels();
    FontMetrics metric = grp.getFontMetrics();
    for (Channel channel : channelArr) {
      String msg = channel.getCopyrightNotice();
      // repeatedly reduce the font size while the copyright notice is wider than the column
      while (metric.stringWidth(msg) > mColumnWidth) {
        Font font = grp.getFont();
        grp.setFont(font.deriveFont((float)(font.getSize()-1)));
        metric = grp.getFontMetrics();
      }
    }
View Full Code Here

Examples of java.awt.FontMetrics

  rep = "None";
      }
      java.awt.Font originalFont = gfx.getFont();
      gfx.setFont(originalFont.deriveFont(java.awt.Font.BOLD));

      FontMetrics fm = gfx.getFontMetrics();
      int vpad = (box.height - fm.getHeight());
      gfx.drawString(rep, 2, fm.getAscent() + vpad);
      int repwidth = fm.stringWidth(rep);

      gfx.setFont(originalFont);
      if ((m_Object instanceof OptionHandler) && !(m_Object instanceof CustomDisplayStringProvider)) {
  gfx.drawString(" " + Utils.joinOptions(((OptionHandler)m_Object).getOptions()),
                 repwidth + 2, fm.getAscent() + vpad);
      }
    }
  }
View Full Code Here

Examples of java.awt.FontMetrics

   * @param gfx the graphics context to use
   * @param box the area we are allowed to paint into
   */
  public void paintValue(java.awt.Graphics gfx, java.awt.Rectangle box) {

    FontMetrics fm = gfx.getFontMetrics();
    int vpad = (box.height - fm.getHeight()) / 2;
    String rep = m_ListModel.getSize() + " " + m_ElementClass.getName();
    gfx.drawString(rep, 2, fm.getAscent() + vpad + 2);
  }
View Full Code Here

Examples of java.awt.FontMetrics

    }
   
    public Dimension getPreferredSize() {

      Font f = this.getFont();
      FontMetrics fm = this.getFontMetrics(f);
      return new Dimension(0, fm.getHeight());
    }
  };
      } catch (Exception ex) {
  return null;
      }
View Full Code Here

Examples of java.awt.FontMetrics

  public Dimension getPreferredSize() {
    if(mPreferredSize != null) {
      return mPreferredSize;
    }
   
    FontMetrics fmBold = getFontMetrics(mBoldFont);
    FontMetrics fmPlain = getFontMetrics(mPlainFont);
   
    int height = mIconHeight;
    int width = fmPlain.stringWidth(mProgram.getTitle().length() > 70 ? mProgram.getTitle().substring(0,67) + "..." : mProgram.getTitle()) + mInsets.left + mInsets.right + 10;
   
    if(height != 0) {
      width += mIcon.getIconWidth() + getIconTextGap();
    } else {
      width += 30;
    }
   
    if(mShowName) {
      width += Settings.propTrayChannelWidth.getInt() + getIconTextGap();
    }
    if(mShowStartTime) {
      width += TIME_WIDTH;
    }
    if(mShowDate) {
      width += DATE_WIDTH;
    }
   
    if(height == 0) {
      if(mShowStartTime || mShowDate) {
        height = fmBold.getHeight();
      } else {
        height = fmPlain.getHeight();
      }
     
      height += mInsets.top + mInsets.bottom;
    } else {
      height += 2;
View Full Code Here

Examples of java.awt.FontMetrics

        g2d.drawRoundRect((int) rect.getX(), (int) rect.getY(),
                (int) rect.getWidth(), (int) rect.getHeight(), arc, arc);

        g2d.clip(rect);
        if (text != null) {
            FontMetrics metrics = g2d.getFontMetrics(g2d.getFont());
            ArrayList<TextLayout> layouts = breakLines((int) rect.getWidth() - textWidthOffset * 2,
                    text, metrics);

            int textHeight = metrics.getHeight();
            int top = textHeight;
            for (TextLayout layout : layouts) {
                layout.draw(g2d, (float) rect.getX() + textWidthOffset, (float) rect.getY() + top);
                top += textHeight;
            }
View Full Code Here

Examples of java.awt.FontMetrics

    return tip;
  }

  @Override
  public Point getToolTipLocation(MouseEvent event) {
    FontMetrics metrics = this.getFontMetrics(this.getFont());
    int stringWidth = SwingUtilities.computeStringWidth(metrics, this.getText());
    int x = 0;
    Icon icon = this.getIcon();

    int iconWidth = getIcon().getIconWidth();
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.