Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

drawing differences on mac/pc
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

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Haase
07-29-04 02:08 AM


Re: drawing differences on mac/pc
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.

Report this thread to moderator Post Follow-up to this message
Old Post
Roedy Green
07-29-04 02:08 AM


Re: drawing differences on mac/pc
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

Report this thread to moderator Post Follow-up to this message
Old Post
Andrew Thompson
07-29-04 02:08 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:25 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.