Java Draw String drawString(Graphics g, String text, int x, int y)

Here you can find the source of drawString(Graphics g, String text, int x, int y)

Description

draw String

License

Open Source License

Declaration

public static void drawString(Graphics g, String text, int x, int y) 

Method Source Code


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

import java.awt.Graphics;

public class Main {
    public static void drawString(Graphics g, String text, int x, int y) {
        for (String line : text.split("\n"))
            g.drawString(line, x, y += g.getFontMetrics().getHeight());
    }//  w w w .ja v a2 s .  c om
}

Related

  1. drawString(Graphics g, String s, int x, int y, int width, int height)
  2. drawString(Graphics g, String s, int x, int y, int width, int height)
  3. drawString(Graphics g, String text, int underlinedChar, int x, int y)
  4. drawString(Graphics g, String text, int underlinedChar, int x, int y)
  5. drawString(Graphics g, String text, int underlinedChar, int x, int y)
  6. drawString(Graphics g2, String string, int x, int y, Font font, Color color)
  7. drawString(Graphics2D g, String s, int x, int y, int width)
  8. drawString(Graphics2D g, String string, double x, double y, Color color)
  9. drawString(Graphics2D g, String string, int x, int y)