Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Font.stringWidth()


  }
    RenderedWord.fontSize = fontSize;
    for (int i = 0; i < 7; i++) {
    Font f = Font.getFont(Font.FACE_PROPORTIONAL, i, fontSize);
      RenderedWord.font[i] = f;
      RenderedWord.fontWidth[i] = f.stringWidth(" ");
    }
    RenderedWord.heightFont = Font.getFont(Font.FACE_PROPORTIONAL,
      Font.STYLE_PLAIN, fontSize).getHeight() +
      AbstractView.getLineSpace();
  }
View Full Code Here


  }
    RenderedWord.fontSize = fontSize;
    for (int i = 0; i < 7; i++) {
    Font f = Font.getFont(Font.FACE_PROPORTIONAL, i, fontSize);
      RenderedWord.font[i] = f;
      RenderedWord.fontWidth[i] = f.stringWidth(" ");
    }
    RenderedWord.heightFont = Font.getFont(Font.FACE_PROPORTIONAL,
      Font.STYLE_PLAIN, fontSize).getHeight() +
      AbstractView.getLineSpace();
  }
View Full Code Here

    public void addButton( final ToolButton button )
    {
        if( button.image == null )
        {
            final Font font = this.font;
            final int width = font.stringWidth( button.text ) + 2;
            final int height = font.getHeight() + 2;
            button.image = Image.createImage( width, height );
            final Graphics g = button.image.getGraphics();
            g.setColor( 0xD0D0D0 );
            g.fillRect( 0, 0, width, height );
View Full Code Here

        for( int i = 0; i < count && index < lines; i++ )
        {
            final String word = (String) words.elementAt( i );
            if( !skipping )
            {
                final int stringWidth = font.stringWidth( word );
                boolean newLine = false;
                if( word.charAt( 0 ) == '\n' )
                {
                    newLine = true;
                }
View Full Code Here

        if( selected.help != null )
        {
            g.setFont( helpFont );
            g.setColor( color );
            if( helpFont.stringWidth( selected.help ) > getWidth() - 2 )
            {
                g.drawString(
                    selected.help,
                    1,
                    getHeight() - helpFont.getHeight() + helpFont.getBaselinePosition() - 1,
View Full Code Here

                                 int width) {
        if (width < 0) {
            return 0;
        }
        final Font font = g.getFont();
        final int stringWidth = font.stringWidth(str);

        if (width >= stringWidth) {
            return str.length();
        }
        final int widthForTruncatedText = width - font.charWidth(truncationMark);
View Full Code Here

    boolean focus = element.isFocused();

    if (indices == null) {
      if (focus) {
      Skin.get().fillFocusRect(g, dx, dy,
            font.stringWidth(text), font.getHeight());
      }
      g.setColor(textColor);
      g.setFont(font);
      g.drawString(text, dx, dy, Graphics.TOP | Graphics.LEFT);
    } else {
View Full Code Here

    Font font = new Style().getFont();

    // Set default indent with to sufficient space for ordered lists with
    // two digits and the default paragraph spacing to 50% of the font height
    // (so top and bottom spacing adds up to a full line)
    int defaultIndent = font.stringWidth("88. ") * 1000;
    int defaultParagraphSpace = Math.max(1, font.getHeight() / 2) * 1000;
   
    put(":link", new Style().set(Style.COLOR, 0x0ff0000ff, Style.ARGB).
        set(Style.TEXT_DECORATION, Style.UNDERLINE, Style.ENUM));
    put("address", new Style().set(Style.DISPLAY, Style.BLOCK, Style.ENUM));
View Full Code Here

          g.drawRoundRect(dx - size - en, liy + size, size, size, size / 2, size / 2);
          break;
        case Style.DECIMAL:
          String nr = (getParent().indexOfChild(this) + 1) + ". ";
          g.setFont(f);
          g.drawString(nr, dx - f.stringWidth(nr), liy, Graphics.TOP | Graphics.LEFT);
          break;
        case Style.DISC:
          g.fillRoundRect(dx - size - en, liy + size, size, size, size / 2,
              size / 2);
          break;
View Full Code Here

    }
   
    int len = text.length();
   
    if (breakPos > len) {
      int w = Math.min(font.stringWidth(text), maxWidth);
      borders.placeBox(w, fontHeight, Style.NONE, 0);
     
      indices = null;
      setX(getX() + borders.getBoxX());
      setWidth(w);
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.