Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Copyright (c) 2013, Bui Nguyen Thang, thang.buinguyen@gmail.com, thangbui.net. All rights reserved.
 * Licensed under the GNU General Public License version 2.0 (GPLv2)
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
 */

import java.awt.*;

import java.util.Map;

public class Main {
    public static void setFontAttribute(Component component, Object key, Object value) {
        Font original = component.getFont();
        Map attributes = original.getAttributes();
        attributes.put(key, value);
        component.setFont(original.deriveFont(attributes));
    }
}