com.mucommander.ui.text
Class FontUtils

java.lang.Object
  extended by com.mucommander.ui.text.FontUtils

public class FontUtils
extends java.lang.Object

This class contains a set of helper methods that allow to easily change the font of a JComponent

Author:
Maxence Bernard

Constructor Summary
FontUtils()
           
 
Method Summary
static void changeSize(javax.swing.JComponent comp, float newSize)
          Changes the size of the given component's font.
static void changeStyle(javax.swing.JComponent comp, int newStyle)
          Changes the style of the given component's font.
static void changeStyleAndSize(javax.swing.JComponent comp, int newStyle, float newSize)
          Changes the style and size of the given component's font.
static void makeBold(javax.swing.JComponent comp)
          Changes the style of the given component's font to Font.BOLD.
static void makeBoldItalic(javax.swing.JComponent comp)
          Changes the style of the given component's font to Font.BOLD|Font.ITALIC.
static void makeItalic(javax.swing.JComponent comp)
          Changes the style of the given component's font to Font.ITALIC.
static void makeMini(javax.swing.JComponent comp)
          Decreases the size of the given component's font by 2 units.
static void makePlain(javax.swing.JComponent comp)
          Changes the style of the given component's font to Font.PLAIN.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FontUtils

public FontUtils()
Method Detail

changeStyle

public static void changeStyle(javax.swing.JComponent comp,
                               int newStyle)
Changes the style of the given component's font. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font
newStyle - the new Font style to use, see java.awt.Font for allowed values

changeSize

public static void changeSize(javax.swing.JComponent comp,
                              float newSize)
Changes the size of the given component's font. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font
newSize - the new Font size to use, see java.awt.Font for allowed values

changeStyleAndSize

public static void changeStyleAndSize(javax.swing.JComponent comp,
                                      int newStyle,
                                      float newSize)
Changes the style and size of the given component's font. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font
newStyle - the new Font style to use, see java.awt.Font for allowed values
newSize - the new Font size to use, see java.awt.Font for allowed values

makeBold

public static void makeBold(javax.swing.JComponent comp)
Changes the style of the given component's font to Font.BOLD. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font

makeItalic

public static void makeItalic(javax.swing.JComponent comp)
Changes the style of the given component's font to Font.ITALIC. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font

makeBoldItalic

public static void makeBoldItalic(javax.swing.JComponent comp)
Changes the style of the given component's font to Font.BOLD|Font.ITALIC. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font

makePlain

public static void makePlain(javax.swing.JComponent comp)
Changes the style of the given component's font to Font.PLAIN. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font

makeMini

public static void makeMini(javax.swing.JComponent comp)
Decreases the size of the given component's font by 2 units. Other attributes of the font are left unchanged.

Parameters:
comp - the component for which to change the font


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard