Examples of stringWidth()


Examples of java.awt.FontMetrics.stringWidth()

            {
                g.setColor( m_color );
            }           
           
            FontMetrics fm = g.getFontMetrics();
            int width = fm.stringWidth(m_text) + 20;
            int height = fm.getHeight();
           
            g.drawString(m_text, getWidth() - width, getHeight() - height);
        }
    }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

    for (int i = 0 ; i < table.getColumnCount() ; i++){
      int max = 0;
      for (int j = 0 ; j < table.getRowCount() ; j++){
        String value = (String)table.getValueAt(j,i);
        if (value!=null){
          int taille = fm.stringWidth(value);
          if (taille > max)
            max = taille;
        }
      }
      String nom = (String)table.getColumnModel().getColumn(i).getIdentifier();
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

          if (taille > max)
            max = taille;
        }
      }
      String nom = (String)table.getColumnModel().getColumn(i).getIdentifier();
      int taille = fm.stringWidth(nom);
      if (taille > max)
        max = taille;
      table.getColumnModel().getColumn(i).setPreferredWidth(max+10);
      ret+=max+10;
    }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

        newMetricsNeeded = false;

        FontMetrics fontMetrics = getFontMetrics(getFont());
        stringAscent = fontMetrics.getAscent();
        stringDescent = fontMetrics.getDescent();
        stringWidth = fontMetrics.stringWidth(message) + shadowX;
        stringHeight = stringAscent + stringDescent + shadowY;

        //  Set initial yoffset
        calculateInitialYOffset();
    }
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

      if (i % labelSpan == 0) {
     String label = String.valueOf(min + (j * labelSpan));
    offset = 0;
    // Place leftmost label to right
    if (i != min)
        offset = fm.stringWidth(label) / 2;
          if (i >= max// Place rightmost label to left
        offset = fm.stringWidth(label);
   
    mygfx.drawString(label, x - offset, size.height/2);
          mygfx.drawLine(x, size.height/2, x, size.height);
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

    offset = 0;
    // Place leftmost label to right
    if (i != min)
        offset = fm.stringWidth(label) / 2;
          if (i >= max// Place rightmost label to left
        offset = fm.stringWidth(label);
   
    mygfx.drawString(label, x - offset, size.height/2);
          mygfx.drawLine(x, size.height/2, x, size.height);
    j++;
      } else
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

      FontMetrics fm = getFontMetrics(getFont());
      Calendar cal = Calendar.getInstance();
      cal.set(Calendar.HOUR_OF_DAY, 23);
      cal.set(Calendar.MINUTE, 59);
      cal.set(Calendar.SECOND, 59);
      _prefSize.width = fm.stringWidth(_fmt.format(cal.getTime()));
      Border border = getBorder();
      if (border != null)
      {
        Insets ins = border.getBorderInsets(this);
        if (ins != null)
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

        Point2D p = t.transform (
          new Point2D.Double (point.getX (), point.getY ()), null);
        g.drawString (text, (int) p.getX (), (int) p.getY ());
       
        FontMetrics fontMetrics = g.getFontMetrics ();
        textWidth = fontMetrics.stringWidth (text);
        textActualHeight = fontMetrics.getAscent () - fontMetrics.getDescent ();
    }
   
    /**
     * Gets the list of selected points.
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

  // returns
  private int getMiddleX(String text, Font font)
  {
    FontMetrics fm = getFontMetrics(font);
    return ( paintWidth/2 - ((fm.stringWidth(text) + 10) / 2)) ;
  }

// ----------------------------------------------------------------------------

  private Font loadFont(String fontName)
View Full Code Here

Examples of java.awt.FontMetrics.stringWidth()

    {
      image.paintIcon(this, g, 0, 0);

      FontMetrics fm = g.getFontMetrics( font1 ) ;

      int x1 = ( getWidth() - fm.stringWidth( versionStr ) ) / 2 ;
      int y1 = getHeight() - fm.getHeight() - 4 ;
      int y2 = getHeight() - 5 ;
/*
      int x1 = ( getWidth() - fm.stringWidth( versionStr ) ) / 2 ;
      int y1 = 4 ;
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.