Examples of stringWidth()


Examples of com.sun.dtv.lwuit.Font.stringWidth()

        int dayHeight = (ch / 6);

        long sd = cal.getSelectedDay();
        Date date = new Date();

        int fix = f.stringWidth("22") / 2;


        g.setColor(mv.getStyle().getBgSelectionColor());
        g.fillRect(mv.getX() + 2, mv.getY() + 2, mv.getWidth() - 4, mv.getStyle().getFont().getHeight());
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

    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.stringWidth()

      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.stringWidth()

   
    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;
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

      }
     
      // Draw the header line if appropriate
      if (head != null) {
        g.drawString(head,
            (int) Math.round((imWidth - fm.stringWidth(head)) / 2),
            fm.getAscent());
        if (g2 != null) {
          imHeight -= headHeight;
          g2.translate(0, headHeight);
        }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

        String hz = tickCounter.getTickRate();
        if (hz != null && !hz.equals("")) {
          g.setColor(TICK_RATE_COLOR);
          g.setFont(TICK_RATE_FONT);
          FontMetrics fm = g.getFontMetrics();
          int x = getWidth() - fm.stringWidth(hz) - 5;
          int y = fm.getAscent() + 5;
          g.drawString(hz, x, y);
        }
      }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

   
    private void paintString(Graphics g, String msg) {
      Font old = g.getFont();
      g.setFont(old.deriveFont(Font.BOLD).deriveFont(18.0f));
      FontMetrics fm = g.getFontMetrics();
      int x = (getWidth() - fm.stringWidth(msg)) / 2;
      if (x < 0) x = 0;
      g.drawString(msg, x, getHeight() - 23);
      g.setFont(old);
      return;
    }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

      g.setColor(headerColor);
      g.setFont(headerFont);
      g.drawString("Logisim", x, y + 45);
      g.setFont(copyrightFont); fm = g.getFontMetrics();
      str = "\u00a9 " + Main.COPYRIGHT_YEAR;
      g.drawString(str, x + IMAGE_WIDTH - fm.stringWidth(str), y + 16);
      g.setFont(versionFont); fm = g.getFontMetrics();
      str = "Version " + Main.VERSION_NAME;
      g.drawString(str, x + IMAGE_WIDTH - fm.stringWidth(str), y + 75);
    }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

      g.setFont(copyrightFont); fm = g.getFontMetrics();
      str = "\u00a9 " + Main.COPYRIGHT_YEAR;
      g.drawString(str, x + IMAGE_WIDTH - fm.stringWidth(str), y + 16);
      g.setFont(versionFont); fm = g.getFontMetrics();
      str = "Version " + Main.VERSION_NAME;
      g.drawString(str, x + IMAGE_WIDTH - fm.stringWidth(str), y + 75);
    }

    public void ancestorAdded(AncestorEvent arg0) {
      if (thread == null) {
        thread = new PanelThread(this);
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

    int x = this.x;
    int y = this.y;
    FontMetrics fm;
    if (font == null)   fm = g.getFontMetrics();
    else                fm = g.getFontMetrics(font);
    int width = fm.stringWidth(text);
    int ascent = fm.getAscent();
    int descent = fm.getDescent();
    switch (halign) {
    case TextField.H_CENTER:    x -= width / 2; break;
    case TextField.H_RIGHT:  x -= width; break;
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.