Home > Archive > Java Help > July 2004 > drawing differences on mac/pc
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
drawing differences on mac/pc
|
|
| Mark Haase 2004-07-28, 9:08 pm |
| hey all--
i'm sure some of you gurus out there can answer this question..
i'm developing a series of simulationa applets on mac os x; my boss uses
windows so its important that the applets work correctly on both
platforms. i have access to a PC for testing, and the one thing I've
noticed is that drawing text to the screen varies between the two
platforms when you insert escaped characters into the string to be drawn.
for instance, I wanted to have a 2 line label, so I just put
new Label("FirstLine\nSecondLine");
on my mac this works fine, on the dell laptop i use for testing it
prints it out all one line with the '\n' character printed out as "\n".
i thought maybe it was a line separator issue, since windows uses
something different (CRLF instead of LF?), but I'm also using
drawString() to put a status line at the bottom of my applet, and I
wanted to use \t to space out four numbers evenly. again, my mac
displays the tabs as blank spaces, on my bosses computer it showed "\t".
i havent yet checked to see if the version numbers are different or not,
but i'm wondering if anybody knows what the java specification says
about this issue? ie. are escape characters *supposed* to be honored by
all string displaying routines
if i upgrade the JVMs on my test machine and my bosses machine, will the
hidden characters display correctly? or is it the Apple JVM thats out of
spec? if so, are there any convenience methods to do what I want?
thanks in advance
--
|\/| /| |2 |<
mehaase(at)sas(dot)upenn(dot)edu
| |
| Roedy Green 2004-07-28, 9:08 pm |
| On Sat, 24 Jul 2004 16:35:09 -0400, Mark Haase <mehaase@earthlink.net>
wrote or quoted :
>for instance, I wanted to have a 2 line label, so I just put
>
>new Label("FirstLine\nSecondLine");
>
>on my mac this works fine,
It is not supposed to work fine. It is just a fluke it does on the
Mac.
You can use a JLabel with a <br>
Java In a Nutshell has an example of how to roll your own multiline
Label, even in Java 1.0.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
| |
| Andrew Thompson 2004-07-28, 9:08 pm |
| On Sat, 24 Jul 2004 16:35:09 -0400, Mark Haase wrote:
> i'm developing a series of simulationa applets on mac os x; my boss uses
> windows so its important that the applets work correctly on both
> platforms.
"We have both types - Country *and* Western", huh?
> for instance, I wanted to have a 2 line label, so I just put
>
> new Label("FirstLine\nSecondLine");
That will not work reliably with a Label,
though in Swing you could use HTML formatting
for the JLabel, as most Swing components 'speak'
HTML.
> if i upgrade the JVMs on my test machine and my bosses machine,
Definitely. Your boss should be taking action
to protect her/his browser from the MSVM, it is a
broken and obsolete 'Java', that MS itself is
advising people remove.
I have a program designed to do just that.
<http://www.physci.org/jvmclean.jsp>
Trawl through the links at the top for more info.
and links you can use to convince the boss to upgrade..
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
|
|
|
|