I have a question about how to properly and or/if use html entitites in java for example in ones jlabel objects in some
html encoded string? What guidelines should you consider before you use them too frequently. As an example i am a
terrible "graphist" so instead of using images as icons for buttons or download them free somewhere i use stars, plus
and minus signs and etc, encoded in html strings. There is a good page for entities i use often and like very much,
fileformat.info. I am shortly above a beginners grade in java and my english might have a few remarks in its grammar.
But gladely post comments on this topic. Is it a generally good idea to use html entities instead of graphics in
ones projects? Im just curious, not an expert. I hope this is a general question.
Interesting question to which I don't know the answer. There will be an extra overhead involved in parsing and rendering the HTML over plain text but then there is an extra overhead for rendering images as well. I would imagine you would have to be displaying a great many components before it is likely to be a problem. You could always write a test program to display a few hundred components displaying plain text, another for HTML and a third with images and see if there is any noticeable difference for initial loading, redraws etc.
As to your question, if they do what you want, why not?
Be aware that the font you use may not contain the unicode glyphs, or may render them differently from other fonts. Make sure you choose a font that contains the glyphs that you want.
More info: There are even font sets that have "graphics" as glyphs in place of "normal" characters for icons that unicode may not contain, which I find very useful for things like button icons. But I'm 100% web focused so your mileage may vary.
I've done what you're sort of asking, although HTML entities would have been the long way around. Java supports the entire Unicode character set so using the Unicode characters directly is the most straightforward way.
For example: in my Swing application, if a sighting entry has notes attached to it then I display ♫ next to it. The Java way to express that character is "\u266b", so that's what is in my code, not the HTML character escape.