One of our support emails drew my attention to a glaring ommission in our icon font support…
When we create an icon for a
Button it’s color matches the unselected color of the button which might not
look as attractive when the
Buton is selected or pressed!
The thing is that with an icon font this is trivial to accomplish and requires literally no code changes. So starting with
the the next update calling
FontImage.setMaterialIcon(Label l, char icon)
FontImage.setMaterialIcon(Label l, char icon, float size)
Button will implicitly set the pressed/selected & disabled icons for the button.
Form f = new Form("Buttons", BoxLayout.y()); CheckBox pressed = CheckBox.createToggle("Pressed"); pressed.setUIID("Button"); FontImage.setMaterialIcon(pressed, FontImage.MATERIAL_THUMB_UP, 5); pressed.setSelected(true); Button unselected = CheckBox.createToggle("Unselected"); unselected.setUIID("Button"); FontImage.setMaterialIcon(unselected, FontImage.MATERIAL_THUMB_UP, 5); Button disabled = CheckBox.createToggle("Disabled"); disabled.setUIID("Button"); FontImage.setMaterialIcon(disabled, FontImage.MATERIAL_THUMB_UP, 5); disabled.setEnabled(false); f.add(pressed). add(unselected). add(disabled); f.show();
PSA – Always Use UTF-8
Everyone has their “pet peeve” about Java and mine is the encoding support. In a typical Sun way the Java API
chose the wrong defaults aligning itself with the system instead of aligning itself with whats right.
UTF-8 works for pretty much everyone and using it universally would solve many of the problems we see frequently.
However, Java defaults to platform native encoding and so minor mistakes like calling the
can be devastating and hard to track. To make matters even more annoying the correct method
throws a checked exception for no real reason making it far more painful to use than the default…
I was reminded of this just the other day, it seems our Properties
ISO-8859-1 encoding. This is pretty much the most standard encoding and should be supported everywhere…
Properties instead of fixing the encoding which is apparently challenging.