Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import javax.swing.JLabel;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Main {
    public static void changeFontSize(JLabel label, int newSize) {
        label.setFont(label.getFont().deriveFont((float) newSize));
    }

    public static void changeFontSize(JTextField textField, int newSize) {
        textField.setFont(textField.getFont().deriveFont((float) newSize));
    }

    public static void changeFontSize(JTextArea textArea, int newSize) {
        textArea.setFont(textArea.getFont().deriveFont((float) newSize));
    }

    public static void changeFontSize(JSpinner spinner, int newSize) {
        spinner.setFont(spinner.getFont().deriveFont((float) newSize));
    }
}