Hi,
Your point about the "cheap" implementation is a good one. After all,
how do we know where to put the "\n" character, since different operation
systems have different look and feel parameters.
1. The levels of warning is a standard part of the user interace (question mark,
explanation mark, and the like), and one would want to use these instead of
"re-inventing the wheel" by rolling your own alert box code. You can
probably get around this unknown by having your application only use one look and feel,
regardless of which operating system it is running on: metal (I think it's called,
and it comes with every later edition of the
Java Run-time environment).
2. I'm not certain whether the font sizes used in the Metal look-and-feel, even
if that look and feel is running on a Mac or a Windows machine are identical.
They probably are very close. One idea would be to make each line 75% of the
width of the box.
3. If your text message is quite long, then you can either
3a. Look for a Sun supplied class that will assist you (I don't know of any myself,
though they certainly might exist),
3b. Roll your own dialog box by extending JDialog. But, again, I would not
do this unless your text message were overly long. I have forgotten if there
is any line limit on JOptionPane; but, you don't want to many lines for at some
point, for very small screens, the text won't show up properly.
Again, I agree with your concern; certainly these pop-up's should do all the
text wrapping, and come with automatic scroll bars.
Thanks,
Javini Javono