Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Component;
import java.awt.Font;

public class Main {
    /**
     * Change a component's Font size.
     * <p>
     * The Font family and Font style are preserved in the updated Font.
     * @param component The component to change the Font presentation of.
     * @param size The new size of Font.
     * @return The new Font installed to the component.
     */
    public static Font changeFontSize(Component component, float size) {
        Font existingFont = component.getFont();
        Font newFont = existingFont.deriveFont(size);
        component.setFont(newFont);
        return newFont;
    }
}