Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Graphics;

public class Main {
    /** Draw 'str' at the given location, but process newlines by moving
     * to a new line. */
    public static void drawTextWithNewlines(Graphics g, String str, int x, int y) {
        String lines[] = str.split("\n");
        int lineHeight = g.getFontMetrics().getHeight();
        for (String s : lines) {
            g.drawString(s, x, y);
            y += lineHeight;
        }
    }
}