Examples of charWidth()


Examples of java.awt.FontMetrics.charWidth()

                    // do nothing
                }
            }
            final FontMetrics fontMetrics
                = textComponent.getFontMetrics(textComponent.getFont());
            final int charWidth = fontMetrics.charWidth(widestChar);
            Dimension size = textComponent.getPreferredSize();

            size.width = width * charWidth;
            textComponent.setPreferredSize(size);
            textComponent.setMaximumSize(size);
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

    }

    private void evaluate(final Font f) {
        if (f != null) {
            FontMetrics fm = getFontMetrics(f);
            columnWidth = fm.charWidth('m');
        } else {
            columnWidth = 0;
        }
    }
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

     */
    private void evaluate(final Font f) {
        if (f != null) {
            FontMetrics fm = getFontMetrics(f);
            rowHeight = fm.getHeight();
            columnsWidth = fm.charWidth('m');
        } else {
            rowHeight = 0;
            columnsWidth = 0;
        }
    }
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

      fCharWidths = new int[len];
      fPosition = new int[len];
      char ch;
      for (int i = 0; i < len; i++) {
        ch = data[i];
        fCharWidths[i] = fm.charWidth(ch);
        if (fCharWidths[i] > fWidth)
          fWidth = fCharWidths[i];
        fCharStrings[i] = new String(data, i, 1);
        // small kana and punctuation
        if (sDrawsInTopRight.indexOf(ch) >= 0) // if ch is in sDrawsInTopRight
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

        int charWidth;
        if(c == '\t')
          charWidth = (int)painter.nextTabStop(width,i)
            - width;
        else
          charWidth = fm.charWidth(c);

        if(painter.isBlockCaretEnabled())
        {
          if(x - charWidth <= width)
            return i;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

          int charWidth;
          if(c == '\t')
            charWidth = (int)painter.nextTabStop(width,offset + i)
              - width;
          else
            charWidth = fm.charWidth(c);

          if(painter.isBlockCaretEnabled())
          {
            if(x - charWidth <= width)
              return offset + i;
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

          }
        }
        int temp = fm.charsWidth(text, start, i-start);
        rect.x = (int)stableX + temp;
        if (text[i]=='\t')
          rect.width = fm.charWidth(' ');
        else
          rect.width = fm.charsWidth(text, start,i-start+1) - temp;
        return rect;
      }
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

        int lineCount = textArea.getLineCount();
        while (lineCount >= 10) {
          lineCount = lineCount/10;
          count++;
        }
        cellWidth += fontMetrics.charWidth('9')*(count+1) + 5;
      }
    }

    if (cellWidth!=oldCellWidth) { // Always true
      revalidate();
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

        doc.clearUndos();
    }

    public void setTabs(int charactersPerTab) {
        FontMetrics fm = getFontMetrics(getFont());
        int charWidth = fm.charWidth('w');
        int tabWidth = charWidth * charactersPerTab;

        TabStop[] tabs = new TabStop[10];

        for (int j = 0; j < tabs.length; j++) {
View Full Code Here

Examples of java.awt.FontMetrics.charWidth()

                flushIndex = i + 1;
                if (txt[i] == '\t') {
                    if (e != null) {
                        nextX = (int) e.nextTabStop((float) nextX, startOffset + i - txtOffset);
                    } else {
                        nextX += metrics.charWidth(' ');
                    }
                } else if (txt[i] == ' ') {
                    nextX += metrics.charWidth(' ') + spaceAddon;
                    if (i <= spaceAddonLeftoverEnd) {
                        nextX++;
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.