org.opensourcephysics.tools
Class FontSizer

java.lang.Object
  extended by org.opensourcephysics.tools.FontSizer

public class FontSizer
extends java.lang.Object

A class for setting relative font sizes by level.

Version:
1.0
Author:
dobrown

Method Summary
static void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
static double getFactor(int level)
          Gets the factor corresponding to a specified level.
static int getLevel()
          Gets the current font level.
static java.awt.Font getResizedFont(java.awt.Font font, double factor)
          Resizes a font by a specified factor.
static java.awt.Font getResizedFont(java.awt.Font font, int level)
          Resizes a font to a specified level.
static void levelDown()
          Decrements the font level and informs all listeners.
static void levelUp()
          Increments the font level and informs all listeners.
static void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener.
static void setFonts(java.lang.Object obj, int level)
          Sets the fonts of an object to a specified level.
static void setLevel(int n)
          Sets the font level and informs all listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setLevel

public static void setLevel(int n)
Sets the font level and informs all listeners.

Parameters:
n - a non-negative integer level

getLevel

public static int getLevel()
Gets the current font level.

Returns:
the level

levelUp

public static void levelUp()
Increments the font level and informs all listeners.


levelDown

public static void levelDown()
Decrements the font level and informs all listeners.


setFonts

public static void setFonts(java.lang.Object obj,
                            int level)
Sets the fonts of an object to a specified level.

Parameters:
obj - the object
level - the level

getResizedFont

public static java.awt.Font getResizedFont(java.awt.Font font,
                                           int level)
Resizes a font to a specified level.

Parameters:
font - the font
level - the level

getResizedFont

public static java.awt.Font getResizedFont(java.awt.Font font,
                                           double factor)
Resizes a font by a specified factor.

Parameters:
font - the font
factor - the factor

getFactor

public static double getFactor(int level)
Gets the factor corresponding to a specified level.

Parameters:
level - the level
Returns:
the factor

addPropertyChangeListener

public static void addPropertyChangeListener(java.lang.String property,
                                             java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
property - the name of the property (only "level" accepted)
listener - the object requesting property change notification

removePropertyChangeListener

public static void removePropertyChangeListener(java.lang.String property,
                                                java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.

Parameters:
property - the name of the property (only "level" accepted)
listener - the listener requesting removal