Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2005

Tip: Looking for answers? Try searching our database.

Preserve Line Breaks

Thread view: 
Roedy Green - 28 Dec 2005 22:25 GMT
Which data entry components preserve line breaks entered in text?  How
do you enter them without triggering a Submit?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

hilz - 28 Dec 2005 22:47 GMT
> Which data entry components preserve line breaks entered in text?  How
> do you enter them without triggering a Submit?

JTextArea ?
Roedy Green - 29 Dec 2005 01:04 GMT
>> Which data entry components preserve line breaks entered in text?  How
>> do you enter them without triggering a Submit?
>
>JTextArea ?

I have discovered TextArea works and presumably JTextArea.  . It
seems to embed enter and tab keystrokes.. How are you supposed to
navigate to the next field? with the mouse?
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Andrew Thompson - 29 Dec 2005 01:27 GMT
>>>Which data entry components preserve line breaks entered in text?  How
>>>do you enter them without triggering a Submit?
[quoted text clipped - 4 lines]
> seems to embed enter and tab keystrokes.. How are you supposed to
> navigate to the next field? with the mouse?

'Control Tab' will take the caret out of a TextArea, to
the next focusable component.

Signature

Andrew Thompson
physci, javasaver, 1point1c, lensescapes - athompson.info/andrew

Thomas Hawtin - 29 Dec 2005 11:32 GMT
>>>> Which data entry components preserve line breaks entered in text?  How
>>>> do you enter them without triggering a Submit?
>>>
>>> JTextArea ?

Actually (I believe) all the standard JTextComponents preserve new
lines. It's just that the return and enter keys don't always enter a
line break...

Take your favourite Java application. Copy some text including a new
line from a text area. Paste into a text field. Unless there is some
DocumentFilter shenanigans going on, the new line should be pasted. You
can then use the arrow keys to move up and down through the slit view.
Same goes for tabs. Can be useful for search and replace.

>> I have discovered TextArea works and presumably JTextArea.  . It seems
>> to embed enter and tab keystrokes.. How are you supposed to
>> navigate to the next field? with the mouse?
>
> 'Control Tab' will take the caret out of a TextArea, to
> the next focusable component.

It seems a bizarre approach to usability to me. Field traversal uses a
peculiar key (tab) instead of a more natural key (return). Then when it
comes to text areas the traversal key is used to enter a character code
that presumably is almost never wanted.

Return would be an even better choice if it wasn't moved out miles to
right. Obviously it's more important to have symbols like ~ and # in
closer. And ; as a home key (other than for curly brace language
programmers).

Going back to my call centre days I had an interesting usability
problem. Following the existing DOS environment, I had return move to
the next field. That didn't make sense for text areas, so tab needed to
be used as a fallback.

To complicate matter I (briefly) had a bug where a field with a single
new line would prevent the form from being submitted. Agents returning
through fields would hit a text area and when return didn't work would
switch to the tab key. The form wouldn't submit. They would swear blind
that they always used tab, but there would be a new line in the first
text area.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/



Free Magazines

Get 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 ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.