Java Font Text Bounds getStringBounds(Graphics2D g, Font font, String s)

Here you can find the source of getStringBounds(Graphics2D g, Font font, String s)

Description

get String Bounds

License

Open Source License

Declaration

public static Rectangle2D getStringBounds(Graphics2D g, Font font,
            String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.*;
import java.awt.geom.*;

public class Main {
    public static Rectangle2D getStringBounds(Graphics2D g, Font font,
            String s) {/*from  w  w w.ja  v  a2  s . c om*/

        return g.getFontMetrics(font).getStringBounds(s, g);

    }
}

Related

  1. getStringBounds(Graphics2D g2, String s)
  2. getStringBounds(Graphics2D g2, String str, float x, float y)
  3. getStringBounds(Graphics2D g2d, String text, int x, int y)
  4. getStringBounds(String s, Graphics g)