Package javax.microedition.lcdui

Examples of javax.microedition.lcdui.Font


    mainYOffset = 0;
    lastLineYOffset = 0;
   
    BlockWidget parent = (BlockWidget) getParent();

    Font font = getFont();
    int maxWidth = borders.getMaxWidth();
    int fontHeight = font.getHeight();

    int availableWidth = borders.getHorizontalSpace(fontHeight);

    // breakpos invalid?
    if (breakPos == -1) {
      breakPos = Math.max(0,
          findBreakPosition(parent, myIndex, 0, availableWidth,
              availableWidth == maxWidth));
    }
   
    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);
      setHeight(fontHeight);
      return breakPos - len;
    }

    StringBuffer buf = new StringBuffer();
    int lastBreak = 0;

    int h = Math.max(borders.getLineHeight(), fontHeight);
    borders.setLineHeight(h);
    firstLineYOffset = borders.getAdjustmentY(h - fontHeight);
    mainYOffset = h - fontHeight - firstLineYOffset;
   
    do {
      int end = breakPos;
      if (end > lastBreak && text.charAt(end - 1) <= ' ') {
        end--;
      }

      buf.append((char) lastBreak);
      buf.append((char) (end - lastBreak));
     
      int w = Math.min(font.substringWidth(text, lastBreak, end - lastBreak),  maxWidth);
     
      if (lineStartIndex != insertionIndex) {
        ((BlockWidget) getParent()).adjustLine(lineStartIndex,
            insertionIndex, borders);
        lineStartIndex = insertionIndex;
      }
     
      borders.placeBox(w, fontHeight, borders.getLineHeight(), 0);
      buf.append((char) (borders.getBoxX() +
          borders.getAdjustmentX(availableWidth - w)));
      borders.advance(borders.getLineHeight());
     
      lastBreak = breakPos;
     
      availableWidth = borders.getHorizontalSpace(fontHeight);
      breakPos = Math.max(lastBreak, findBreakPosition(parent, myIndex, lastBreak, availableWidth,
          availableWidth == maxWidth));
     
      h += fontHeight;
    } while (breakPos <= len);

    buf.append((char) lastBreak);
    buf.append((char) (text.length() - lastBreak));
    int w = Math.min(font.substringWidth(text, lastBreak,
        text.length() - lastBreak), borders.getHorizontalSpace(fontHeight));
   
    borders.placeBox(w, fontHeight, Style.NONE, 0);
    buf.append((char) borders.getBoxX());
   
View Full Code Here


    public static int getSize(String text, Graphics g)
    {
        int size = 0;
        int L = text.length();
        Font font = g.getFont();
        for(int i = 0;i < L;++i)
        {
            size += font.charWidth(text.charAt(i));
        }

        return size;
    }
View Full Code Here

        setCommandListener(this);

    }
    protected void paint(Graphics g)
    {
        Font f = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN,
                Font.SIZE_SMALL);
        g.setFont(f);
        int fHeight = g.getFont().getHeight();
        int suratesPerColumn = _height / fHeight - 2;
        int suratesToView = 2 * suratesPerColumn;
 
View Full Code Here

           else{
                stepPaint=0;
           }
           //System.out.println(stepPaint);
           g.setColor(0,0,0);
           Font waitFont = Font.getFont(Font.FACE_MONOSPACE, Font.STYLE_PLAIN, Font.SIZE_SMALL);
           g.setFont(waitFont);           
           g.drawString(messageWait, 0, 0, g.TOP | g.LEFT );           
        }
        catch(Exception ex)
        {
View Full Code Here

TOP

Related Classes of javax.microedition.lcdui.Font

Copyright © 2018 www.massapicom. 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.