Mac WORA

Discussion in 'Java' started by Roedy Green, May 4, 2008.

  1. Roedy Green

    Roedy Green Guest

    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
    Roedy Green, May 4, 2008
    #1
    1. Advertising

  2. On May 4, 2:21 am, Roedy Green <>
    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
    Owen Jacobson, May 4, 2008
    #2
    1. Advertising

  3. In article <>,
    Roedy Green <> 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, May 14, 2008
    #3
  4. In article <>,
    "John B. Matthews" <> wrote:

    > In article <>,
    > Roedy Green <> 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
    John B. Matthews, May 14, 2008
    #4
  5. Roedy Green

    Roedy Green Guest

    On Sun, 04 May 2008 00:29:55 -0700, "Peter Duniho"
    <> 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, May 15, 2008
    #5
  6. Roedy Green

    Roedy Green Guest

    On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
    <> 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, May 15, 2008
    #6
  7. Roedy Green

    Roedy Green Guest

    On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
    <> 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
    Roedy Green, May 15, 2008
    #7
  8. In article <>,
    Roedy Green <> wrote:

    > On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
    > <> 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, May 15, 2008
    #8
  9. In article <>,
    Roedy Green <> wrote:

    > On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews"
    > <> 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
    John B. Matthews, May 15, 2008
    #9
  10. Roedy Green

    Roedy Green Guest

    On Thu, 15 May 2008 16:38:35 -0400, "John B. Matthews"
    <> 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
    Roedy Green, May 15, 2008
    #10
  11. In article <>,
    Roedy Green <> wrote:

    > On Thu, 15 May 2008 16:38:35 -0400, "John B. Matthews"
    > <> 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"?


    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
    --
    John B. Matthews
    trashgod at gmail dot com
    home dot woh dot rr dot com slash jbmatthews
    John B. Matthews, May 16, 2008
    #11
  12. Roedy Green

    Roedy Green Guest

    On Thu, 15 May 2008 20:39:20 -0400, "John B. Matthews"
    <> wrote, quoted or indirectly quoted someone who
    said :

    >os.name = Mac OS X


    I have used that to flip to single arrows on the mac. Could you
    please check that it works.

    see http://mindprod.com/applet/canadiantax.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, May 16, 2008
    #12
  13. Roedy Green

    Roedy Green Guest

    On Thu, 15 May 2008 11:44:41 GMT, Roedy Green
    <> wrote, quoted or indirectly quoted
    someone who said :

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

    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, May 16, 2008
    #13
  14. In article <>,
    Roedy Green <> wrote:

    > On Thu, 15 May 2008 20:39:20 -0400, "John B. Matthews"
    > <> wrote, quoted or indirectly quoted someone who
    > said :
    >
    > >os.name = Mac OS X

    >
    > I have used that to flip to single arrows on the mac. Could you
    > please check that it works.
    >
    > see http://mindprod.com/applet/canadiantax.html


    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.

    John
    --
    John B. Matthews
    trashgod at gmail dot com
    home dot woh dot rr dot com slash jbmatthews
    John B. Matthews, May 16, 2008
    #14
  15. Roedy Green

    Roedy Green Guest

    On Fri, 16 May 2008 15:41:48 -0400, "John B. Matthews"
    <> wrote, quoted or indirectly quoted someone who
    said :

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

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, May 18, 2008
    #15
  16. In article <>,
    Roedy Green <> wrote:

    > On Fri, 16 May 2008 15:41:48 -0400, "John B. Matthews"
    > <> wrote, quoted or indirectly quoted someone who
    > said :
    >
    > >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.


    Excellent!

    John
    --
    John B. Matthews
    trashgod at gmail dot com
    home dot woh dot rr dot com slash jbmatthews
    John B. Matthews, May 18, 2008
    #16
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roman =?ISO-8859-15?Q?Bl=F6th?=

    Senseless rendering: Mac.Mozilla != Mac.Netscape6.01 ?!?!

    Roman =?ISO-8859-15?Q?Bl=F6th?=, Jul 2, 2003, in forum: HTML
    Replies:
    1
    Views:
    988
    Steve Pugh
    Jul 2, 2003
  2. mangm
    Replies:
    2
    Views:
    730
    mangm
    Dec 1, 2005
  3. Tom Anderson

    Re: WORA high performance

    Tom Anderson, May 30, 2008, in forum: Java
    Replies:
    2
    Views:
    321
    Tom Anderson
    Jun 1, 2008
  4. Roedy Green

    Font WORA blues.

    Roedy Green, Jul 27, 2008, in forum: Java
    Replies:
    5
    Views:
    290
    Roedy Green
    Jul 29, 2008
  5. owais

    Java claims WORA

    owais, Jun 20, 2012, in forum: Java
    Replies:
    27
    Views:
    732
    John B. Matthews
    Jun 26, 2012
Loading...

Share This Page