Swing text areas break user flow when cycling focus with tab key


When cycling throuh a single record grid in the swing client you can cycle through all fields with the tab key. Only for JTextAreas (multiline text fields) this changes. You have to use Ctrl-Tab to cycle. Because this key does not work for the other kinds of fields the user has to switch his method while tabbing.

iDempiere has multiline "Description" fields in many tables. It is often places in the upper part of the input grid (behind search key and name). If you use such a table the focus is on the first field. To enter data into the real data fields (that are more at the bottom) you have to cycle over the description field.

The reason for this is AFAIS that Java creators wanted a possibility to enter a TAB character into the field.

I wonder how Compiere/ADempiere/iDempiere could live so long without someone complaining about this but I could not find an earlier tracker request.

Solution is easy. I don't know if anyone wants to insert TAB characters in iDempiere. But if you could do that with Copy & Paste as a workaround. Perhaps we can just switch the key binding and use Ctrl-Tab to enter a TAB character.


all environments up to Java7


Hesham Ahmed
January 24, 2013, 3:54 AM

The reason for no tab and shift enter was to be consistent with zk since zk doesnt provide tab and uses (used ?) Shift enter for newline whatever the case is I prefer we keep zk and swing consistent with each other. I agree with making tab behavior default.

Thomas Bayen
January 21, 2013, 12:31 AM

I committed my code here https://bitbucket.org/tbayen/idempiere/commits/b3b0499183f50d4a2396f545c560b81a66331274

Please review and tell if you think we should discuss about Configuration or something else. I do not often use zk so someone might tell how user interaction is there so we keep it the same in both clients.

Before giving this code into trunk we need a migration script to change the description of the System Configuration. I did not want to do that before review of the community for the whole issue.


Thomas Bayen
January 20, 2013, 9:52 PM

Fine! After two hours of research I realized that solved this and is to be activated by a System Configuration.

After thinking for a second I realized that this is not solved at best. I want to divide this into two issues:

The old behaviour is very annoying and I can see no reason to keep it. I consider it as a bug. I propose we do not need a System Configuration for that. We could discuss about that point regarding to conditioned users but I believe they all will just breathe up. We still should have a way to enter TAB characters (I propose Ctrl-Tab). If we want this configurable it has nothing to do with the Enter part. So we would need two System Configuration Entries. And using Tab for cycling should definitely be the default.

There are good reasons to use Enter to insert newlines in a multiline text field (that's what multiline fields are for...). And there are good reasons to behave like other fields and let save them with "Enter + F4". (I bet that Hesham would not have raised if he could have used "Tab + F4".) So I propose to let this configurable like it is. But I want to get his code dealing with Tab out of the configured code path. And I want "Shift-Enter" to do the same regardless of the System Configuration. So this will be a keystroke everyone can rely on independent from the configuration setting. At last I want to ask if we use Ctrl-Enter (to be consistent with Ctrl-Tab) or Shift-Enter (like Hesham did) or both (so everyone is happy).




Thomas Bayen


Thomas Bayen


Tested By



Affects versions