🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12978

Re: Can't catch any KeyEvent from JText components

#12978
From: Anne JANSSENS
Date: Wed, 14 Oct 1998 00:00
25 lines
1236 bytes
I have no problem to catch keyEvent on JTextField, or JTextArea.
If there are keyEventListener implemented, it is the first listener that
is taken in account before keyMap!

Here is the example of a keyEvent on JTextField :

myJtextField.addKeyListener(new keyAdapter()
{   void keyPressed(KeyEvent evt)
    { // for example, i don't want 'A' to appear in my text component
      if (evt.getKeyChar()=='A') evt.consume();
    }

    void keyTyped(KeyEvent evt)
   {}
   void keyReleased(KeyEvent evt)
   {}
}
);

If you want more information about the Swing Text Package
go on the Swing Connection  :
http://java.sun.com/products/jfc/txc/swingdoc-static/text.html

Hope it could help
Anne
Technical Details
Message-ID: <702k0k$k1i26@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <361B4921.D25A820C@collegemail.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,8c2091517781a7ac
X-Google-Attributes: gid111d45,public
From: "Anne JANSSENS" <recherche@generix.fr>
Subject: Re: Can't catch any KeyEvent from JText components
Date: 1998/10/14
Message-ID: <702k0k$k1i26@forums.borland.com>
X-Deja-AN: 401033747
References: <361B4921.D25A820C@collegemail.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing