Package org.opensourcephysics.tools
Class FontSizer
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.tools.FontSizer
A class for setting relative font sizes by level.
- Version:
- 1.0
- Author:
- dobrown
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Font
Base font for menu acceleratorsstatic final ResizableIcon
static final Font
Base font for buttonsstatic final ResizableIcon
static final ResizableIcon
Icons for checkbox, radio button and arrow menu itemsstatic final int
static final int
maximum font levelstatic final String
static final ResizableIcon
static final ResizableIcon
static final Font
Base font for text fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addListener
(String property, PropertyChangeListener listener) Adds a PropertyChangeListener.static double
Gets the current factor.static double
getFactor
(int level) Gets the factor corresponding to a specified level.static int
Gets the current integer factor.static int
getIntegerFactor
(int level) Gets the integer factor corresponding to a specified level.static int
getLevel()
Gets the current font level.static Font
getResizedFont
(Font font, double factor) Resizes a font by a specified factor.static Font
getResizedFont
(Font font, int level) Resizes a font to a specified level.static void
Decrements the font level.static void
levelUp()
Increments the font level.static void
removeListener
(String property, PropertyChangeListener listener) Removes a PropertyChangeListener.static int
static int
setFont
(AbstractButton button) static int
static int
static int
Sets the fonts of an object to a specified level.static int
setFontsIfNot
(int oldLevel, Object c) static void
setLevel
(int n) Sets the font level and informs all listeners.static int
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
PROPERTY_LEVEL
- See Also:
-
TEXT_FONT
Base font for text fields -
BUTTON_FONT
Base font for buttons -
ACCELERATOR_FONT
Base font for menu accelerators -
CHECKBOXMENUITEM_ICON
Icons for checkbox, radio button and arrow menu items -
RADIOBUTTONMENUITEM_ICON
-
CHECKBOX_ICON
-
RADIOBUTTON_ICON
-
ARROW_ICON
-
MIN_LEVEL
public static final int MIN_LEVELmaximum font level- See Also:
-
MAX_LEVEL
public static final int MAX_LEVEL- See Also:
-
-
Method Details
-
setFontsIfNot
-
setMenuFonts
-
setFonts
-
setFonts
-
setFont
-
setFont
-
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. -
levelDown
public static void levelDown()Decrements the font level. -
getFactor
public static double getFactor()Gets the current factor.- Returns:
- the factor
-
getIntegerFactor
public static int getIntegerFactor()Gets the current integer factor.- Returns:
- the integer factor
-
setFonts
Sets the fonts of an object to a specified level.- Parameters:
obj
- the objectlevel
- the level- Returns:
-
getResizedFont
Resizes a font to a specified level.- Parameters:
font
- the fontlevel
- the level- Returns:
- the resized font
-
getResizedFont
Resizes a font by a specified factor.- Parameters:
font
- the fontfactor
- the factor- Returns:
- the resized font
-
getFactor
public static double getFactor(int level) Gets the factor corresponding to a specified level.- Parameters:
level
- the level- Returns:
- the factor
-
getIntegerFactor
public static int getIntegerFactor(int level) Gets the integer factor corresponding to a specified level.- Parameters:
level
- the level- Returns:
- the integer factor
-
addListener
Adds a PropertyChangeListener.- Parameters:
property
- the name of the property (only "level" accepted)listener
- the object requesting property change notification
-
removeListener
Removes a PropertyChangeListener.- Parameters:
property
- the name of the property (only "level" accepted)listener
- the listener requesting removal
-