Mac WORA

R

Roedy Green

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.
 
O

Owen Jacobson

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
 
J

John B. Matthews

Roedy Green said:
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
 
J

John B. Matthews

"John B. Matthews said:
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
 
R

Roedy Green

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.
 
R

Roedy Green

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.
 
R

Roedy Green

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
 
J

John B. Matthews

Roedy Green 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
 
J

John B. Matthews

Roedy Green said:
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
 
R

Roedy Green

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"?
 
J

John B. Matthews

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

Not for many years!:)
....
os.name = Mac OS X
....
line.separator = [binary char: 0x0a i.e. Lf, \n]
....

I like this! I think displaySafeProperties() may be missing a choice.
Are there any "\r" implementations, other than Mac OS before X?

As an test, I rejected your certificate and (correctly) received the
safe list.

I haven't found a definitive answer as to which physical fonts my
implementation uses for the platform's logical fonts.

John
 
R

Roedy Green

canDisplay may or may not work, since it sometimes claims to display a
char when all it really displays is a blob.

I have put in an RFE on this failure of Font.canDisplay along with
three suggested kludges to partially fix it.

1. detect many chars mapped to the same dud char, and treat those as
false.

2. provide custom canDisplay maps for the logical fonts.

3. use same physical font for logical fonts on all platforms.
canDisplay stays broken, but at least it is WORA.
 
R

Roedy Green

Looks good; I sent a picture. The dimensions are good, too. The
os.equals( "Mac OS" ) may be superfluous; Mac's of that vintage run Java
1.1.

A got a message from a Mac user who was delighted it was now working
properly. Thanks for all your efforts, and others too.
 
J

John B. Matthews

Roedy Green said:
A got a message from a Mac user who was delighted it was now working
properly. Thanks for all your efforts, and others too.

Excellent!

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top