Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JimCrowell

macrumors newbie
Original poster
Feb 5, 2010
9
0
Syracuse, New York
FYI: I am developing on a new iMac using Mac OS X 10.6.2, Java 1.5.x and the Eclipse 3.4 [Ganymede]. Previously developing on a Win XP system until I purchased a new iMac...


I am developing a Java stand alone application and debugging it on a Win XP node and a Mac OS X node.

Often I have JDialog windows that have one or more text fields and a JButton at the bottom that uses the ‘setMnemonic’ method to enable ‘alt/key’ keyboard combinations to be used by my end user.
These Dialogs work fine on the XP node.

On the Mac OS X node, sometimes, when I enter the ‘Alt/key’ keyboard combination an 8 bit character is entered into the text field component that has the focus.

For example, when entering a ‘Alt/c’ combo to activate a “Continue” JButton, the errant character is the Latin small letter c with cedilla extended ascii character [231 base 10, E7 base 16].

Questions:

I know that Mac OS X uses Unicode encoding somehow, thus the
8 bit character but why are these Latin characters being randomly inserted at the focus point of my text fields?

Has anyone heard of such a problem on the Mac OS X platform?

Can you recommend a link that details the differences between Java Application hosted in a Mac and a Win XP system?
 
I think I understand the problem you're having. This functionality is only needed on Windows (possibly Linux too, not sure) and NOT on the Mac OS, since the Mac OS handles international characters in a completely different way.

On Windows, to type most international characters, ALT+NNNN codes need to be used, where N is a number on the numeric keypad. On the Mac OS, however, international characters are also typed using ALT (called Option on the Mac side), but with easy to remember mnemonics. For instance, to type ñ on Windows, use the code ALT+0241. On Mac OS, use Option+n n (i.e. press and hold Option, press the N key, release both keys, then press the N key again).

Therefore, I'd think that you can simply turn off that feature in your Java application on the Mac OS.
 
I found this useful link for Java UI considerations.


Thanks.

I read that link and perhaps see where I should do more work on the Mac OS X system. I tried [unsuccessfully] to add an Aqua Look And Feel. Maybe later!

This does not resolve my original problem.
I tried different Look and Feel options but the problem still exist i.e. I still see the 8 bit character in my text field after doing an "Alt/C" or an "Option/C" keyboard combination.
 
I think I understand the problem you're having. This functionality is only needed on Windows (possibly Linux too, not sure) and NOT on the Mac OS, since the Mac OS handles international characters in a completely different way.

On Windows, to type most international characters, ALT+NNNN codes need to be used, where N is a number on the numeric keypad. On the Mac OS, however, international characters are also typed using ALT (called Option on the Mac side), but with easy to remember mnemonics. For instance, to type ñ on Windows, use the code ALT+0241. On Mac OS, use Option+n n (i.e. press and hold Option, press the N key, release both keys, then press the N key again).

Therefore, I'd think that you can simply turn off that feature in your Java application on the Mac OS.


I think my original request must be poorly written.
I am not trying to enter an international code.

I am trying to activate a JButton by entering the "Alt/C" or "Option/C" key combinations.The 'keyPressed' Method is successfully entered and the required method is invoked, i.e. the JButton action is as required.

However, the dialog text field that had the focus when I entered the combo keys has an additional character placed at the text field insertion point.

The errant character is an 8 bit int [E7 =base 16][1110 0111 - base 2], i.e the Latin small letter c with cedilla extended ascii character after I enter the "Alt/C" keyboard combo.

The windows XP application works fine, i.e. no errant character is inserted.

Tomorrow I will try to make an .app file and execute it from the Java Terminal. This will verify for me that the problem is not Eclipse related.
 

I think my original request must be poorly written.
I am not trying to enter an international code.

I am trying to activate a JButton by entering the "Alt/C" or "Option/C" key combinations.The 'keyPressed' Method is successfully entered and the required method is invoked, i.e. the JButton action is as required.

However, the dialog text field that had the focus when I entered the combo keys has an additional character placed at the text field insertion point.

The errant character is an 8 bit int [E7 =base 16][1110 0111 - base 2], i.e the Latin small letter c with cedilla extended ascii character after I enter the "Alt/C" keyboard combo.

The windows XP application works fine, i.e. no errant character is inserted.

Tomorrow I will try to make an .app file and execute it from the Java Terminal. This will verify for me that the problem is not Eclipse related.
I see... that won't work in Mac OS X. You'll need to use some other key, like Control, on the Mac side, to make this work properly, since Alt is reserved for international characters.
 
I see... that won't work in Mac OS X.
You'll need to use some other key, like Control, on the Mac side, to make this work properly, since Alt is reserved for international characters.


OK.

All I did in my code was use the JButton .setsetMneumonic ('c') method which made the "Alt/c" combo work except for the errand char problem.

In your first reply you suggested turning the international capability off.
Is there a way to do that?

If I change to another key combo, I think I'd have to do some Mac specific key assignments where ever I now employ the JButton.setMneumonics method. All lot of work. Is there a system level method to change the JButton "Alt/c" to "Control/c"?
 

OK.

All I did in my code was use the JButton .setsetMneumonic ('c') method which made the "Alt/c" combo work except for the errand char problem.

In your first reply you suggested turning the international capability off.
Is there a way to do that?

If I change to another key combo, I think I'd have to do some Mac specific key assignments where ever I now employ the JButton.setMneumonics method. All lot of work. Is there a system level method to change the JButton "Alt/c" to "Control/c"?
You misread me, I wasn't saying to turn the international input in Mac OS X off - as far as I know that isn't possible. Also, did you read the API documentation for JButton's setMnemonic method? It does say that it uses the mouseless modifier key, which isn't Alt on Mac OS X - it's probably Control instead; it DOES say that the mouseless key is USUALLY Alt... but that doesn't apply to Mac OS X, because of the way it uses the Alt key. (Remember, to access the menubar from the keyboard, press Control+F2 on Mac OS X, or just Alt on Windows.) That said... try pressing Control+C on Mac OS X, and see if it activates the JButton as desired.
 
You misread me, I wasn't saying to turn the international input in Mac OS X off - as far as I know that isn't possible. Also, did you read the API documentation for JButton's setMnemonic method? It does say that it uses the mouseless modifier key, which isn't Alt on Mac OS X - it's probably Control instead; it DOES say that the mouseless key is USUALLY Alt... but that doesn't apply to Mac OS X, because of the way it uses the Alt key. (Remember, to access the menubar from the keyboard, press Control+F2 on Mac OS X, or just Alt on Windows.) That said... try pressing Control+C on Mac OS X, and see if it activates the JButton as desired.
.


Earlier I tried "Control+C" and "Command+C".
Neither worked.

I'll look around to see if there is a system wide programmable method to change from "Alt+C" to something else.

Thanks for all the help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.