This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I can't type any characters that require the option(alt) key when using NetBeans 3.2 release candidate 1 (or any other earlier builds I've tried) on MacOS X. I have tried both US and Swedish keyboard layouts. It seems like the KeyEvents get consumed before they reach the editor. Since this prevents typing such charcters as {,},|,[,] and \, I may be missing something obvious, but I simply can't figure it out. I have noticed that some other Swing apps and demos have this problem, but that other work just fine.
Can you tell me which application works? I think this a bug in Apple JDK, since it did not work for me and even the very simple Swing application does not work correctly.
I compiled the two classes TextComponentDemo and LimitedStyleDocument, which can be found at http://java.sun.com/docs/books/tutorial/uiswing/ components/example-swing/, and executed the TextComponentDemo class from a shell, ie "java TextComponentDemo". The JTextPane in the demo app accepts characters such as {, [ and |. Not being a Swing expert, I can only guess that is has something to do with the default Keymaps for various Components in Apple's JDK.
I think we cannot do anything until the JEditorPane (and therefore our JEP too) will start working properly with Apple JDK. There is no way we could rewrite the NB editor to use JTextPane instead JEditorPane. Unfortunately we have not enough resources to dig into why the JTextPane works and JEditorPane not. I guess the only thing we can do is to look into some Mac mailing conferences whether this problem was investigated already.
Target milestone -> 3.3
Reported to Apple as bug ID #2702599. I am closing this as won't fix. Please open if this will not work in next Java SDK release from Apple, please reopen.
*** Issue 15123 has been marked as a duplicate of this issue. ***
*** Issue 16133 has been marked as a duplicate of this issue. ***
*** Issue 15977 has been marked as a duplicate of this issue. ***
In issue 16133 which was closed as duplicate of this issues the user has MacOS X (version 10.1) and reported (in mailing list only) that our testing JEP.java works fine and so I would say that the problem is in NetBeans. Tomas, which version your Mac runs? 10.1? Is it possible that part of the bug was already fixed in Apple JDK and that now it is bug in NetBeans?
Just to say everything that I know about this bug: The problem is that the DefaultKeyTypedAction filters out the KEY_TYPED events that have Alt or Ctrl modifiers and leaves only the events with no modifiers or Ctrl+Alt modifier (necessary for national keyboard keys). However this does not work on Mac where the Alt+something shortcuts are meaningful for regular typing. So on Mac there is a special version of Swing with special DefaultKeyTypedAction that enables Alt+something to be typed into the document.NB (and other apps) overrides DefaultKeyTypedAction to allow code completion, abbrevs and other advanced features to work. It currently preserves Ctrl+Alt modifiers but not Alt+something shortcuts because these are used on Mac only in their own special Swing version. IMO it's a difficult situation because the VM on Mac in order to be fine with the standard DefaultKeyTypedAction would have to emulate the Ctrl+Alt modifiers in some key events which is unnatural. On the other hand the standard Swing cannot allow KEY_TYPED events with just Alt modifiers to be entered into the document because there could be additional unwanted characters typed into the document for each Alt+something shortcut. We in NB could only make a special patch testing whether we are on Mac OS X platform allowing KEY_TYPED events with just Alt modifiers. I'm not sure however whether e.g. Alt+a will not enter additional 'a' character into the text. In this case the users would have to remap all Alt+something shortcuts to something else.
I can confirm that JEP works correctly under Mac OS X 10.1.
JEP works correctly only in Aqua L&F, since Apple does its own keyboard handling in Aqua L&F. This cannot be used in Netbeans. Issue is still unresolved and depends primary on resolving issue "No way to determine if KeyTyped valid key sequence" reported against Swing classes. See: http://developer.java.sun.com/developer/bugParade/bugs/4435010.html
Created attachment 3387 [details] Patch to temporary solve this issue for Netbeans 3.3
Created attachment 3399 [details] Compiled patch. Use it only on Mac OS X with non-US keyboard running Netbeans 3.3 beta 4 or higher
******************* PATCH INSTALLATION ******************* Extract this patch (file os_x_keyboard_patch.tar.gz) to $NETBEANS_HOME/modules/patches directory. If you installed it correctly you should see following line in console and ide.log when starting Netbeans: Module patch or custom extension: /tmp/netbeans/modules/patches/org-netbeans-modules-editor/os_x_keyboard.jar Use it only with Netbeans 3.3 beta 4 or higher. You have to use Aqua L&F only since this patch corrects the problem in Netbeans editor - default Swing keyboard handling is used in other places like text fields comboboxes etc. so in Metal L&F you still will not be able to type characters with alt key modifier. The patch is in fact a hack - therefore it is provided as an attachment to this issue for those who need to solve this issue immediately.
Just to say this issue also exists under Debian GNU/Liunx PPC, Blackdown JVM... I just can't type any {} or ¦ I think the patch wouldn't wrk on that environment, would it ? Franck
Franck I think that there is good chance that this patch will work. Try it and let us know.
*** Issue 18912 has been marked as a duplicate of this issue. ***
The patch does not seem to work for FFJ 3.0, or rather it cannot be installed. There was no modules/patches directory, so I created it, but no success. I also tried modules/, modules/ext/ and lib/patches, in both the installation and the user hierarchies (I do not know which one is the $FORTE_HOME directory.) The console does not show anything about os_x_keyboard.jar at startup. Is there some trick with Forte and patches?
The main problem is that the patch is for NetBeans 3.3 or higher. This is clearly mentioned on www.netbeans.org/articles/mac.html page and in the patch description itself. FFJ 3.0 is based on NetBeans 3.2.1 so the patch will not work with FFJ 3.0.
I've installed the patch on Mac OS X 10.1.4 using Netbeans 3.3.1 and it seems to work fine even in the metal look and feel (which is quicker than the Aqua look and feel). Thanks.
*** Issue 26344 has been marked as a duplicate of this issue. ***
*** Issue 28114 has been marked as a duplicate of this issue. ***
*** Issue 28977 has been marked as a duplicate of this issue. ***
Hi Tomas, Iv tried to install the os_x_keyboard_patch.jar and am still having problems.. Iv copied it to my modules/patches dir in sunone studio 4 update 1 in both the /Developer/Applications/Sun One Studio 4 /s1Studio/ce/modules/patches and into my user dir of /Users/stephenw/ffjuser40ce/modules/patches but with no avail. When I open up sunone I dont get any messages in ide.log file and the alt key behaviour is still the same, i.e. no curlies on a swedish keyboard. Also added mac look and feel to get the aqua lf by editing ide.cfg :- -jdkhome /usr/local/java -J-Xmx96m -J-Xss1024k -J-Xms24m -J-Xverify:none -ui com.apple.mrj.swing.MacLookAndFeel I also tried netbeans NetBeansIDE_3.4.1 for osx ( downloaded yesterday ) and copied the patch into modules/patches dir and same result i.e. no alt key functionality.. Would really appreciate some guidance on this, Stephen.
Hi All, I fised my problem by adding the jar file to :- modules/patches/org-netbeans-modules-editor/os_x_keyboard.patch Now why was'nt "org-netbeans-modules-editor" mentioned in the installation notes?? Huge thanks for community help and the patch, Stephen
Stephen, There is no need to mention org-netbeans-modules-editor. The problem is that you did not follow the installation instruction correctly. The instruction says: Extract this patch (file os_x_keyboard_patch.tar.gz) to $NETBEANS_HOME/modules/patches directory. The file os_x_keyboard_patch.tar.gz contains org-netbeans-modules-editor directory. thurka% gnutar tvzf os_x_keyboard_patch.tar.gz drwxr-xr-x th125165/wheel 0 2001-11-13 15:19 org-netbeans-modules-editor/ -rw-r--r-- th125165/wheel 5894 2001-11-13 15:19 org-netbeans-modules-editor/os_x_keyboard.jar thurka% So extracting os_x_keyboard_patch.tar.gz into modules/patches directory will create org-netbeans-modules-editor for you if it does not exists.
Created attachment 9867 [details] Updated patch to solve this issue in NetBeans 3.5
Created attachment 9868 [details] Compiled patch for NetBenas 3.5
*** Issue 33696 has been marked as a duplicate of this issue. ***
Resolved for 3.3.x or earlier, no new info since then -> closing.
This appears still to be a problem - should this issue be closed? (it makes it harder for users to find out about it if they search, since they'll probably search open bugs)
Created attachment 14007 [details] Updated patch to solve this issue in NetBeans 3.6
Created attachment 14008 [details] Compiled patch for NetBenas 3.6
The issue is closed since this is a bug in JDK. Users can find this issue very quickly since Mac OS X How to page has direct link to this issue.
will add to release notes.
proposed relnote: On Mac OS X, keyboard shortcuts with the Alt key do not work in the Source Editor. This problem occurs if an archive distribution of the IDE is being run. Workaround: Download and install the <tt>.dmg</tt> image distribution of the IDE, which has a patch to solve this problem on Mac OS X.
relnote comment: keyboard shortcuts works OK. The problem is with typing any characters that require the option(alt). This is mostly case of non-English keyboard layouts, where characters like {,},|,[,] are typed using alt modifier.
OK. I'll reword the sentence to read: On Mac OS X, it is not possible to type characters that require the use of the Alt key.
The Problem reappeared in "NetBeans IDE 4.0 Beta 2 Mac OS X package". I tried to apply the Patch from the latest attachment, but the directory structure has changed, so I didn't even know where to put it. I tried several locations, none worked. This simple issue renders NetBeans completely useless on many computers.
Try a current development build - the fix didn't make it into beta 2, but this is now *permanently* fixed - Alt is no longer the menu accelerator on mac, Ctrl is, all key bindings that were mapped to Alt are now bound to Ctrl (so, fast import is Ctrl-Shift-I, not Alt-Shift-I, on the mac), and the Alt key is free to be used to compose characters on international keyboards. See issue 49806
*** Issue 50542 has been marked as a duplicate of this issue. ***
Closing this old issue.