2006-03-27から1日間の記事一覧

[Java][AWT]テキストを矩形内に表示する

まず、テキストの描画に必要な矩形のサイズを求めます。 public static Rectangle2D.Float getTextRectangle(Graphics2D g2, String text, Font font) { assert g2 != null: g2; assert text != null && text.length() > 0: text; FontRenderContext frc = g…