Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Mac WORA (http://www.velocityreviews.com/forums/t608819-mac-wora.html)

Roedy Green 05-04-2008 06:21 AM

Mac WORA
 
I wrote an Applet the Canadian Tax Calculator at
http://mindprod.com/applet/canadiantax.html run as Applet
http://mindprod.com/products1.html#CANADIANTAX download

I got email from a Mac user this display is scrambled when they run it
on a Mac with Safari.

Yet when they run it standalone from a jar, it works fine.

Questions:

1. would anyone with a Mac please have a look at it and tell me if
they can see what the trouble is.

2. What would I tell to Mac people to explain how to unzip, and
execute a jar? Do they even have a command line?

I suspect the problem may be the size of the Applet window. Perhaps
the Mac needs a lot more screen real estate.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Owen Jacobson 05-04-2008 07:14 AM

Re: Mac WORA
 
On May 4, 2:21*am, Roedy Green <see_webs...@mindprod.com.invalid>
wrote:
> I wrote an Applet the Canadian Tax Calculator athttp://mindprod.com/applet/canadiantax.html*run as Applethttp://mindprod.com/products1.html#CANADIANTAXdownload
>
> I got email from a Mac user this display is scrambled when they run it
> on a Mac with Safari.


Verified on 10.5, Safari 3.0.4, up-to-date Java 1.5.0.

> Yet when they run it standalone from a jar, it works fine.
>
> Questions:
>
> 1. would anyone with a Mac please have a look at it and tell me if
> they can see what the trouble is.
>
> 2. What would I tell to Mac people to explain how to unzip, and
> execute a jar?


If you mean "the JAR is inside a ZIP file":

- download the ZIP. Safari will, by default, unzip it for you; if it
doesn't, the ZIP file will be in ~/Downloads (10.5) or on the Desktop
(10.4 and earlier).
- double-click on the JAR to run it.

If you mean "the JAR itself needs to be unpacked":

- fix your build :)
- download the JAR. Safari will, by default, place it in the same
locations mentioned above.
- open Terminal.app (/Applications/Utilities/Terminal).
- cd ~/Downloads # for 10.5
or cd ~/Desktop # for earlier releases
- jar xf [name of JAR file]

> Do they even have a command line?


The shell on a Mac is bash (in 10.4 and later releases) or tcsh (in
10.0 through 10.3); all of the usual shell-isms and unix-isms are
there. Relying on GNU quirks (like expecting 'rm' or 'cd' to accept
options at the end of the line) is unwise; it often won't work as the
core utilities are derived from the parent BSD code.

-o


John B. Matthews 05-13-2008 11:46 PM

Re: Mac WORA
 
In article <b5lq14pct80kvejqcvhgqcuai704c2rrc5@4ax.com>,
Roedy Green <see_website@mindprod.com.invalid> wrote:

> I wrote an Applet the Canadian Tax Calculator at
> http://mindprod.com/applet/canadiantax.html run as Applet
> http://mindprod.com/products1.html#CANADIANTAX download
>
> I got email from a Mac user this display is scrambled when they run it
> on a Mac with Safari.
>
> Yet when they run it standalone from a jar, it works fine.
>
> Questions:
>
> 1. would anyone with a Mac please have a look at it and tell me if
> they can see what the trouble is.


I see the same thing in the applet, the applet launcher, and the
application: the instructions JLabel is filling a tall, narrow column in
the bottom, center of the window. This forces other components up, until
pstLabel/PST is at the top of the content pane. Commenting out the
corresponding add() eliminates the problem.

It's an intriguing problem in GridBag sorcery, which is why I use nested
BoxLayout:-)

> 2. What would I tell to Mac people to explain how to unzip,
> and execute a jar?


I followed the instruction on the download page, ignoring the "J:\" part.

> Do they even have a command line?


Yes, we have a choice of shells:

$ cat /etc/shells
[...]
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

John B. Matthews 05-14-2008 02:30 AM

Re: Mac WORA
 
In article <nospam-766F06.19461213052008@news-server.woh.rr.com>,
"John B. Matthews" <nospam@nospam.com> wrote:

> In article <b5lq14pct80kvejqcvhgqcuai704c2rrc5@4ax.com>,
> Roedy Green <see_website@mindprod.com.invalid> wrote:
>
> > I wrote an Applet the Canadian Tax Calculator at
> > http://mindprod.com/applet/canadiantax.html run as Applet
> > http://mindprod.com/products1.html#CANADIANTAX download
> >
> > I got email from a Mac user this display is scrambled when they run it
> > on a Mac with Safari.
> >
> > Yet when they run it standalone from a jar, it works fine.
> >
> > Questions:
> >
> > 1. would anyone with a Mac please have a look at it and tell me if
> > they can see what the trouble is.

>
> I see the same thing in the applet, the applet launcher, and the
> application: the instructions JLabel is filling a tall, narrow column in
> the bottom, center of the window. This forces other components up, until
> pstLabel/PST is at the top of the content pane. Commenting out the
> corresponding add() eliminates the problem.

[...]

OK, here's a less radical fix (NONE -> HORIZONTAL):

// x y w h wtx wty anchor fill T L B R padx pady
contentPane.add( instructions,
new GridBagConstraints(
0, 10,
5, 1,
0.0, 0.0,
GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL,
new Insets( 10, 10, 10, 10 ),
0, 0 ) );

Also, a window width of 570 is a little roomier. Oddly, I didn't have
glyphs for \u21d1 & \u21d3, but \u2191 & \u2193 look good.

John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

Roedy Green 05-15-2008 10:46 AM

Re: Mac WORA
 
On Sun, 04 May 2008 00:29:55 -0700, "Peter Duniho"
<NpOeStPeAdM@nnowslpianmk.com> wrote, quoted or indirectly quoted
someone who said :

>Define "scrambled".
>
>On my Mac, I get the same results, whether I run the applet in Opera or
>Safari, or run the standalone JAR file. It's not what I'd call
>"scrambled", but it's not right either.


Here is a time where posting an embedded image would be the way to
fly.

For example, the instructions looked something like this:

o click the up
down amount of
sale spinner
arrows

where it is supposed to appear all on one line.

Other boxes were bunched up as if squeezed left to right to condense
the text to unreadability or not visible.

I thought perhaps the problem was the Mac needed a bigger Applet
Windows for display, but growing it did not seem to help.

The user who complained was inexperienced so could not measure the
size of the application window or experiment with the size of the
applet window.





--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green 05-15-2008 10:54 AM

Re: Mac WORA
 
On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
<nospam@nospam.com> wrote, quoted or indirectly quoted someone who
said :

> GridBagConstraints.HORIZONTAL,


That is what I would normally have coded for an instruction field. It
is distressing that the code works on my PC. I would have thought the
code to implement GridBagLayout would be identical on Mac and PC.

Thank you very much for tracking that down.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green 05-15-2008 11:44 AM

Re: Mac WORA
 
On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
<nospam@nospam.com> wrote, quoted or indirectly quoted someone who
said :

>Also, a window width of 570 is a little roomier. Oddly, I didn't have
>glyphs for \u21d1 & \u21d3, but \u2191 & \u2193 look good.


I added code like this:

// prefer double to single arrow
final char downArrow = dialog.canDisplay( '\u21d3') ?
'\u21d3': dialog.canDisplay( '\u2193' ) ? '\u2193' :'v';
final char upArrow = dialog.canDisplay( '\u21d1') ? '\u21d1':
dialog.canDisplay( '\u2191' ) ? '\u2191' :'^';

calcTotalPayableButton = new JEButton( "Calc "+ downArrow );
calcTotalPayableButton.setToolTipText( "Calculate sales tax"
);

calcSaleAmountButton = new JEButton( "Calc " + upArrow );
calcSaleAmountButton.setToolTipText( "Reverse calculate sale
amount" );


canDisplay may or may not work, since it sometimes claims to display a
char when all it really displays is a blob. Does this work on the
Mac?
I have posted a new downloadable version at
http://mindprod.com/products1.html#CANADIANTAX with this change.

or as an runnable Applet at
http://mindprod.com/applet/canadiantax.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

John B. Matthews 05-15-2008 08:38 PM

Re: Mac WORA
 
In article <4a8o24hptdcdtq60fn4r5jns3namqqaqpq@4ax.com>,
Roedy Green <see_website@mindprod.com.invalid> wrote:

> On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
> <nospam@nospam.com> wrote, quoted or indirectly quoted someone who
> said :
>
> >Also, a window width of 570 is a little roomier. Oddly, I didn't have
> >glyphs for \u21d1 & \u21d3, but \u2191 & \u2193 look good.

>
> I added code like this:
>
> // prefer double to single arrow
> final char downArrow = dialog.canDisplay( '\u21d3') ?
> '\u21d3': dialog.canDisplay( '\u2193' ) ? '\u2193' :'v';
> final char upArrow = dialog.canDisplay( '\u21d1') ? '\u21d1':
> dialog.canDisplay( '\u2191' ) ? '\u2191' :'^';
>

[...]
>
> canDisplay may or may not work, since it sometimes claims to display a
> char when all it really displays is a blob. Does this work on the
> Mac?


As you predicted, canDisplay() returns true, but the glyph is an empty
box (\ufffe?). Interestingly, it's an _italic_ empty box:-)

Changing JEButton's font to "Symobol" seems to work better. "Apple
Symbol", "MS Gothic", "MS Mincho" and "MS PMincho" also have the glyphs
for \u21d1 and \u21d3 ...

[I was going to paste in the names, but that's forbidden by
unicode/adobe/dmca drm, so I'll type this little rant about locked up
"standards," instead. Apparently, the names "UPWARDS DOUBLE ARROW"
"DOWNWARDS DOUBLE ARROW" are copyrighted by Unicode Inc. The words,
constituting less than one millionth of the entire work, are used here
without permission for the purpose of criticism and education:
<http://www.copyright.gov/fls/fl102.html>].

John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

John B. Matthews 05-15-2008 09:02 PM

Re: Mac WORA
 
In article <1f5o241lu0q1g4iu58151qn6jj73vppup6@4ax.com>,
Roedy Green <see_website@mindprod.com.invalid> wrote:

> On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
> <nospam@nospam.com> wrote, quoted or indirectly quoted someone who
> said :
>
> > GridBagConstraints.HORIZONTAL,

>
> That is what I would normally have coded for an instruction field. It
> is distressing that the code works on my PC. I would have thought the
> code to implement GridBagLayout would be identical on Mac and PC.


It is debatable which implementation is incorrect, but the meaning of
GridBagConstraints.NONE ("Do not resize the component.") leaves some
room for interpretation. The usual pitfall of GridBag is failing to set
constraints explicitly, but your code does that. Could the other NONE's
be working because their predecessors each set HORIZONTAL in the same
row? Perhaps the implementation is interpreting NONE to mean "same as
last time."

> Thank you very much for tracking that down.


I always learn something new:-).

John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

Roedy Green 05-15-2008 09:55 PM

Re: Mac WORA
 
On Thu, 15 May 2008 16:38:35 -0400, "John B. Matthews"
<nospam@nospam.com> wrote, quoted or indirectly quoted someone who
said :

>As you predicted, canDisplay() returns true, but the glyph is an empty
>box (\ufffe?). Interestingly, it's an _italic_ empty box:-)


Phht! What happens when you run Wassup and look at the os.name
property.
Do you see "Mac OS"?
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


All times are GMT. The time now is 09:19 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.