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 / First Aid / January 2008

Tip: Looking for answers? Try searching our database.

how to stop user to use Enter Button.

Thread view: 
Akash - 25 Jan 2008 06:31 GMT
HI

I have used a Text Area in my project.

I want the user not able to to press Enter Button in it... if it do
so, the system should prompt the user not to user Enter Key.

how to stop user to use Enter Button.

Awaiting for ur response...

Thanks in Advance

Akash
prakash - 25 Jan 2008 10:45 GMT
hai,
its very Simple add a keyListener to your textArea. if you add the
following to your Key pressed it should do.

 public void keyPressed(KeyEvent e) {
     if (e.getKeyChar() == KeyEvent.VK_ENTER) {
         e.consume();
     }
 }

Regards
Prakash.
apm35@student.open.ac.uk - 25 Jan 2008 12:14 GMT
> HI
>
> I have used a Text Area in my project.
>
> I want the user not able to to press Enter Button in it... if it do
> so, the system should prompt the user not to user Enter Key.

for some reason this remind me of a bit in the HitchHikers Guide to
the Galaxy where Douglas Adams makes fun of user-hostile interfaces.
Our heroes are in an alien spacecraft trying to figure out the
controls. Suddenly Arthur Dent exclaims and Ford Prefect asks what's
wrong. Arthur replies: "I pressed this button and a little light came
on saying 'please do not press that button again'".

Regards,

Andrew Marlow
Hal Rosser - 26 Jan 2008 00:44 GMT
> HI
>
[quoted text clipped - 10 lines]
>
> Akash

If clicking a certain button will cause a problem, then take the option from
the user:
enterButton.setVisible(false)
When its ok for the user to click it,, set it back to true.

HTH
Roedy Green - 26 Jan 2008 02:09 GMT
On Fri, 25 Jan 2008 19:44:37 -0500, "Hal Rosser"
<hmrosser@bellsouth.net> wrote, quoted or indirectly quoted someone
who said :

>If clicking a certain button will cause a problem, then take the option from
>the user:
>enterButton.setVisible(false)
>When its ok for the user to click it,, set it back to true.

he meant "enter key".  That is a little harder to make disappear.
Signature

Roedy Green, Canadian Mind Products
The Java Glossary, http://mindprod.com

Hal Rosser - 26 Jan 2008 04:12 GMT
> On Fri, 25 Jan 2008 19:44:37 -0500, "Hal Rosser"
> <hmrosser@bellsouth.net> wrote, quoted or indirectly quoted someone
[quoted text clipped - 7 lines]
>
> he meant "enter key".  That is a little harder to make disappear.

HAHAHAHA! But imagine if it DID work that way,:-)
I thought he had a JButton. hehe.
ok - back to work..


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.