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 FontBase font for menu acceleratorsstatic final ResizableIconstatic final FontBase font for buttonsstatic final ResizableIconstatic final ResizableIconIcons for checkbox, radio button and arrow menu itemsstatic final intstatic final intmaximum font levelstatic final Stringstatic final ResizableIconstatic final ResizableIconstatic final FontBase font for text fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddListener(String property, PropertyChangeListener listener) Adds a PropertyChangeListener.static doubleGets the current factor.static doublegetFactor(int level) Gets the factor corresponding to a specified level.static intGets the current integer factor.static intgetIntegerFactor(int level) Gets the integer factor corresponding to a specified level.static intgetLevel()Gets the current font level.static FontgetResizedFont(Font font, double factor) Resizes a font by a specified factor.static FontgetResizedFont(Font font, int level) Resizes a font to a specified level.static voidDecrements the font level.static voidlevelUp()Increments the font level.static voidremoveListener(String property, PropertyChangeListener listener) Removes a PropertyChangeListener.static intstatic intsetFont(AbstractButton button) static intstatic intstatic intSets the fonts of an object to a specified level.static intsetFontsIfNot(int oldLevel, Object c) static voidsetLevel(int n) Sets the font level and informs all listeners.static intMethods 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
-