Here you can find the source of changeFontSize(Font font, float factor)
public static Font changeFontSize(Font font, float factor)
//package com.java2s; import java.awt.Font; import javax.swing.JComponent; public class Main { public static Font changeFontSize(Font font, float factor) { int size = (int) Math.round(factor * font.getSize()); if (size < 6) size = Math.max(6, font.getSize()); return new Font(font.getName(), font.getStyle(), size); }// w ww . ja va 2 s .co m public static void changeFontSize(JComponent component, float factor) { component.setFont(changeFontSize(component.getFont(), factor)); } }