Here you can find the source of ChangeFont(JComponent comp, int wheel_rotation)
public static void ChangeFont(JComponent comp, int wheel_rotation)
//package com.java2s; /*Copyright 2008 by Vladimir Polony, Stupy 24, Banska Bystrica, Slovakia //from w w w . j a va2s . co m This file is part of OpenRep FREE homeopathic software. OpenRep FREE is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenRep FREE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenRep FREE. If not, see <http://www.gnu.org/licenses/>.*/ import java.awt.Font; import javax.swing.JComponent; public class Main { public static void ChangeFont(JComponent comp, int wheel_rotation) { int size_inc = 0; if (wheel_rotation > 0) size_inc++; else if (wheel_rotation < 0) size_inc--; if (size_inc != 0) { Font f = new Font(comp.getFont().getName(), comp.getFont().getStyle(), comp.getFont().getSize() + size_inc); comp.setFont(f); comp.repaint(); } } }