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.awt.event.ComponentEvent;

public class Main {
    private static void setFontStyle(Component c, int fontStyle) {
        Font newLabelFont = new Font(c.getFont().getName(), fontStyle, c.getFont().getSize());
        c.setFont(newLabelFont);
    }

    public static void setFontStyle(ComponentEvent event, int fontStyle) {
        Component c = (Component) event.getSource();
        setFontStyle(c, fontStyle);
    }
}