java-melwuitlwuit-resource-editor

How to change programmatically the size of a Font defined in the Resource Editor?


In the Resource Editor I created a Font having a size of 9, and it is proportional, plain and small. Then I created also some UIID which are based on this Font. Now I want to change programmatically the size of this Font under certain circumstance , that is when the height or width of the Display is bigger than a reference value. The new value of the Font size will be then based on the Display size , so it's dynamic. So how to change programmatically the Font size of a Font defined in the Resource Editor ?


Solution

  • That was a hard thing. You can't change programmatically the size of a Resource Editor's Font. You will need to build a Font by code and apply to the app by the Style class. For example if you want to change the Fontof a Label, you must to create the Font, add it to a Style and add this to the Label using the Component method setSelectedStyle() or setPressedStyle(), there are so many methods....