Java tutorial
//package com.java2s; import javax.swing.*; import java.awt.*; public class Main { /** * Change the font of all the passed {@link JComponent}s to the supplied {@link Font}. * * @param font * The {@link Font} to assign to the passed {@link JComponent}s. * @param firstComponent * The first {@link JComponent} to assign the font to. * @param remainingComponents * The rest of the {@link JComponent}s to assign the font to. */ public static void changeFontOfComponents(Font font, JComponent firstComponent, JComponent... remainingComponents) { firstComponent.setFont(font); for (JComponent component : remainingComponents) { component.setFont(font); } } }