Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.awt.Font;

public class Main {
    /**
     * Loads a font using {@link Font#createdFont}
     * @param s - The resource name, ex: /assets/darkmetro/seoeuil.ttf -> darkmetro/segpeuil
     * @return
     */
    public static Font loadFont(String s) {
        try {
            return Font.createFont(Font.TRUETYPE_FONT, System.class.getResourceAsStream("/assets/" + s + ".ttf"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}