Java Forum / General / May 2008
Mac WORA
Roedy Green - 04 May 2008 07:21 GMT 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.
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Owen Jacobson - 04 May 2008 08:14 GMT 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. > [quoted text clipped - 5 lines] > 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
Peter Duniho - 04 May 2008 08:29 GMT > I wrote an Applet the Canadian Tax Calculator at > http://mindprod.com/applet/canadiantax.html run as Applet [quoted text clipped - 4 lines] > > Yet when they run it standalone from a jar, it works fine. 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.
> 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 don't have the time, and possibly not the experience, to try to debug it myself at the moment. But I can describe what I see. Basically, the UI is presented in a window of a specific size, and the components in that window appear to be laid out from the bottom up, exceeding the size of the window.
In other words, I (mostly) see everything at the bottom of your layout, up to the "PST" line of the tool.
Interestingly: in both Opera and Safari, until I scroll the window containing the web page, the contents of the tool are actually laid out such that the top part is visible. It's only as I scroll down that it winds up reflowing.
With the standalone, it's wrong from the outset, but I can easily resize the window so that everything shows.
I can email screen shots to you if you like.
> 2. What would I tell to Mac people to explain how to unzip, and > execute a jar? Do they even have a command line? OS X is basically Unix, and yes...there's a command line. However, the GUI understands ZIP and JAR files. Double-clicking either will "do the right thing". ZIP files get decompressed into a new directory in the same directory where the ZIP file is stored. JAR files will be executed as if you typed the java command line (though of course without any of the command-line options that can't be set in the JAR file itself and which might have been typed on the command-line).
> I suspect the problem may be the size of the Applet window. Perhaps > the Mac needs a lot more screen real estate. IMHO, whether things wind up using up more pixels on the Mac or not (and frankly, this isn't typically an issue), it's bad behavior for the tool to be reflowing the components in the window such that they aren't visible in the window.
I'm less familiar with how Java applets work, but it seems like a bad idea to hard-code the size of something that's not a plain bitmap image in a web page. There are too many different ways for rich text to not be the same size on different clients than on yours. Surely there's a way to allow the applet to be sized according to its own needs.
As far as the standalone version goes, that seems even worse since you're not constrained by a browser window or anything like that at all. The Java frame should just be sized to accommodate the components contained within.
Maybe there's something else going on here that I don't understand, but if this is really just a case of you specifying some hard-coded size for the presentation, that's just not appropriate, especially not in a cross-client/cross-platform environment like Java.
Pete
Roedy Green - 15 May 2008 11:46 GMT 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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
John B. Matthews - 14 May 2008 00:46 GMT > I wrote an Applet the Canadian Tax Calculator at > http://mindprod.com/applet/canadiantax.html run as Applet [quoted text clipped - 9 lines] > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
John B. Matthews - 14 May 2008 03:30 GMT > > I wrote an Applet the Canadian Tax Calculator at > > http://mindprod.com/applet/canadiantax.html run as Applet [quoted text clipped - 15 lines] > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
Roedy Green - 15 May 2008 11:54 GMT 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.
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
John B. Matthews - 15 May 2008 22:02 GMT > On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews" > <nospam@nospam.com> wrote, quoted or indirectly quoted someone who [quoted text clipped - 5 lines] > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
Roedy Green - 15 May 2008 12:44 GMT 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
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
John B. Matthews - 15 May 2008 21:38 GMT > On Tue, 13 May 2008 22:30:36 -0400, "John B. Matthews" > <nospam@nospam.com> wrote, quoted or indirectly quoted someone who [quoted text clipped - 10 lines] > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
Roedy Green - 15 May 2008 22:55 GMT 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"?
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
John B. Matthews - 16 May 2008 01:39 GMT > On Thu, 15 May 2008 16:38:35 -0400, "John B. Matthews" > <nospam@nospam.com> wrote, quoted or indirectly quoted someone who [quoted text clipped - 6 lines] > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
Roedy Green - 16 May 2008 16:27 GMT On Thu, 15 May 2008 20:39:20 -0400, "John B. Matthews" <nospam@nospam.com> 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
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
John B. Matthews - 16 May 2008 20:41 GMT > On Thu, 15 May 2008 20:39:20 -0400, "John B. Matthews" > <nospam@nospam.com> wrote, quoted or indirectly quoted someone who [quoted text clipped - 6 lines] > > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
Roedy Green - 18 May 2008 01:23 GMT On Fri, 16 May 2008 15:41:48 -0400, "John B. Matthews" <nospam@nospam.com> 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.
 Signature
Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
John B. Matthews - 18 May 2008 15:42 GMT > On Fri, 16 May 2008 15:41:48 -0400, "John B. Matthews" > <nospam@nospam.com> wrote, quoted or indirectly quoted someone who [quoted text clipped - 6 lines] > 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
 Signature John B. Matthews trashgod at gmail dot com home dot woh dot rr dot com slash jbmatthews
Roedy Green - 16 May 2008 16:47 GMT On Thu, 15 May 2008 11:44:41 GMT, Roedy Green <see_website@mindprod.com.invalid> 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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|