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;
import java.awt.FontFormatException;

import java.awt.GraphicsEnvironment;

import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static void importFont(InputStream stream) {
        try {
            Font font1 = Font.createFont(Font.TRUETYPE_FONT, stream);
            GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(font1);
        } catch (FontFormatException ex) {
            throw new RuntimeException(ex);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}