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.

Bug 11477 - Can't type characters with alt key modifier in editor
Summary: Can't type characters with alt key modifier in editor
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 4.x
Hardware: Macintosh Mac OS X
: P1 blocker with 1 vote (vote)
Assignee: issues@editor
Keywords: RELNOTE
: 15123 15977 16133 18912 26344 28114 28977 33696 50542 (view as bug list)
Depends on:
Reported: 2001-04-17 15:23 UTC by pfranzen
Modified: 2007-11-05 13:42 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Patch to temporary solve this issue for Netbeans 3.3 (3.00 KB, patch)
2001-11-13 14:56 UTC, Tomas Hurka
Details | Diff
Compiled patch. Use it only on Mac OS X with non-US keyboard running Netbeans 3.3 beta 4 or higher (5.45 KB, application/octet-stream)
2001-11-13 17:31 UTC, Tomas Hurka
Updated patch to solve this issue in NetBeans 3.5 (3.12 KB, patch)
2003-04-11 10:29 UTC, Tomas Hurka
Details | Diff
Compiled patch for NetBenas 3.5 (42.81 KB, application/octet-stream)
2003-04-11 10:31 UTC, Tomas Hurka
Updated patch to solve this issue in NetBeans 3.6 (3.17 KB, patch)
2004-03-17 07:42 UTC, Tomas Hurka
Details | Diff
Compiled patch for NetBenas 3.6 (46.49 KB, patch)
2004-03-17 08:12 UTC, Tomas Hurka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pfranzen 2001-04-17 15:23:08 UTC
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.
Comment 1 Tomas Hurka 2001-04-20 10:52:09 UTC
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
Comment 2 pfranzen 2001-04-20 12:19:03 UTC
I compiled the two classes TextComponentDemo and 
which can be found at
and executed the TextComponentDemo class from a shell, ie "java 
TextComponentDemo". The JTextPane in the demo app accepts 
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.
Comment 3 Miloslav Metelka 2001-05-04 12:30:57 UTC
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.
Comment 4 Jan Chalupa 2001-05-05 21:54:33 UTC
Target milestone -> 3.3
Comment 5 Tomas Hurka 2001-06-06 16:44:23 UTC
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.
Comment 6 Tomas Hurka 2001-09-19 12:54:11 UTC
*** Issue 15123 has been marked as a duplicate of this issue. ***
Comment 7 Jan Lahoda 2001-10-02 16:39:18 UTC
*** Issue 16133 has been marked as a duplicate of this issue. ***
Comment 8 Jan Lahoda 2001-10-02 16:40:48 UTC
*** Issue 15977 has been marked as a duplicate of this issue. ***
Comment 9 David Konecny 2001-10-02 16:52:34 UTC
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 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 
Comment 10 Miloslav Metelka 2001-10-02 17:23:57 UTC
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.
Comment 11 Tomas Hurka 2001-10-04 10:51:56 UTC
I can confirm that JEP works correctly under Mac OS X 10.1.  
Comment 12 Tomas Hurka 2001-11-13 14:50:57 UTC
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:
Comment 13 Tomas Hurka 2001-11-13 14:56:37 UTC
Created attachment 3387 [details]
Patch to temporary solve this issue for Netbeans 3.3
Comment 14 Tomas Hurka 2001-11-13 17:31:34 UTC
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
Comment 15 Tomas Hurka 2001-11-13 17:55:32 UTC
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:

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
Comment 16 franck routier 2001-11-21 08:55:52 UTC
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 ?

Comment 17 Tomas Hurka 2001-11-21 09:38:15 UTC
Franck I think that there is good chance that this patch will work.
Try it and let us know.
Comment 18 Tomas Hurka 2001-12-26 16:59:20 UTC
*** Issue 18912 has been marked as a duplicate of this issue. ***
Comment 19 fitzgunnar 2001-12-27 08:20:53 UTC
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 

Is there some trick with Forte and patches?
Comment 20 Tomas Hurka 2002-02-15 11:14:50 UTC
The main problem is that the patch is for NetBeans 3.3 or higher. This
is clearly mentioned on 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.
Comment 21 stephan 2002-05-04 07:58:20 UTC
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). 
Comment 22 Tomas Hurka 2002-08-07 16:13:24 UTC
*** Issue 26344 has been marked as a duplicate of this issue. ***
Comment 23 Jan Lahoda 2002-10-23 15:44:17 UTC
*** Issue 28114 has been marked as a duplicate of this issue. ***
Comment 24 ehucka 2002-11-25 12:14:41 UTC
*** Issue 28977 has been marked as a duplicate of this issue. ***
Comment 25 maitriyoginmac 2003-02-13 12:36:19 UTC
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

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,
Comment 26 maitriyoginmac 2003-02-13 13:24:58 UTC
Hi All,
I fised my problem by adding the jar file to :-
Now why was'nt "org-netbeans-modules-editor" mentioned in the installation notes??
Huge thanks for community help and the patch,
Comment 27 Tomas Hurka 2003-03-05 08:04:47 UTC
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
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.
Comment 28 Tomas Hurka 2003-04-11 10:29:16 UTC
Created attachment 9867 [details]
Updated patch to solve this issue in NetBeans 3.5
Comment 29 Tomas Hurka 2003-04-11 10:31:01 UTC
Created attachment 9868 [details]
Compiled patch for NetBenas 3.5
Comment 30 Tomas Hurka 2003-05-19 09:14:50 UTC
*** Issue 33696 has been marked as a duplicate of this issue. ***
Comment 31 Tomas Hurka 2003-05-19 09:17:13 UTC
*** Issue 33696 has been marked as a duplicate of this issue. ***
Comment 32 Quality Engineering 2003-06-30 18:14:48 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 33 _ tboudreau 2004-03-12 12:53:30 UTC
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)
Comment 34 Tomas Hurka 2004-03-17 07:42:51 UTC
Created attachment 14007 [details]
Updated patch to solve this issue in NetBeans 3.6
Comment 35 Tomas Hurka 2004-03-17 08:12:17 UTC
Created attachment 14008 [details]
Compiled patch for NetBenas 3.6
Comment 36 Tomas Hurka 2004-03-17 08:30:53 UTC
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.
Comment 37 Patrick Keegan 2004-04-01 16:20:09 UTC
will add to release notes.
Comment 38 Patrick Keegan 2004-04-01 19:26:34 UTC
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.
Comment 39 Tomas Hurka 2004-04-02 15:40:58 UTC
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.
Comment 40 Patrick Keegan 2004-04-05 15:13:42 UTC
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.
Comment 41 Shadowcaster 2004-10-17 14:43:35 UTC
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.
Comment 42 _ tboudreau 2004-10-17 17:41:09 UTC
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
Comment 43 Martin Roskanin 2004-10-19 15:05:38 UTC
*** Issue 50542 has been marked as a duplicate of this issue. ***
Comment 44 Roman Strobl 2005-07-15 11:34:51 UTC
Closing this old issue.