Re: Giving an application a window icon in a sensible way
Twisted wrote:
Mark Rafn wrote:
Wouldn't it be MUCH easier to put gif/jpg/png files directly into the jar,
then let the classloader find them using getResource or getResourceAsStream?
First of all, I don't *have* a jar, at least not yet.
Second of all, this is the kind of thing that should really just work
without being able to bomb with IOExceptions and suchlike, in my
opinion. Retrieving even the most basic stuff from a bunch of external
files adds unnecessary points of failure, and gobs of extra recovery
code to check for and cope with anything that goes wrong. This way, it
Just Works(tm). :)
"It Just Works(TM)" is considered a very bad approach to software
design. Doing things that "Just Work" versus doing things that "Work
Right", tends to save a minute now and cost a week later. What happens
when you have three icons? 10? What happens when you rebrand those 10
icons? Having them as actual image files rather than converting them.
Ouch.
BTW, if you REALLY wanted to go that route, you could do a byte dump of
the original (png/jpeg/gif) image, and use imageio and a
ByteArrayInputStream (there is such a thing, right?). Releasing you
from using the apperantly buggy XImageWhatchamawhosit. Although, I
wouldn't recommend either approach.