Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Customising Swing JTextField

Reply
Thread Tools

Customising Swing JTextField

 
 
David
Guest
Posts: n/a
 
      11-11-2006
Hi,

Im trying to create a custom text box. What I have done is inherited
from the JTextField class, and attached key listeners. However,
obviously swing is calling my listeners then processing the JTextFields
ones. Without using the formatter etc... I want to block key events
from being processed by JTextField. Any ideas how I can achieve this?
Ive tried looking at the source, but just cant seem to find any way to
do this apart from Key-Binding every key on the keyboard, which seems
insane. Im sure theres something easy im missing.

Thanks for the help

David

 
Reply With Quote
 
 
 
 
Richard Wheeldon
Guest
Posts: n/a
 
      11-11-2006
David wrote:
> Im trying to create a custom text box. Without using the formatter etc...


Why? What's wrong with JFormattedTextField?

Richard
 
Reply With Quote
 
 
 
 
hiwa
Guest
Posts: n/a
 
      11-12-2006

David wrote:
> Hi,
>
> Im trying to create a custom text box. What I have done is inherited
> from the JTextField class, and attached key listeners. However,
> obviously swing is calling my listeners then processing the JTextFields
> ones. Without using the formatter etc... I want to block key events
> from being processed by JTextField. Any ideas how I can achieve this?
> Ive tried looking at the source, but just cant seem to find any way to
> do this apart from Key-Binding every key on the keyboard, which seems
> insane. Im sure theres something easy im missing.
>
> Thanks for the help
>
> David

Yours may be DocumentFilter's job.

 
Reply With Quote
 
Kenneth P. Turvey
Guest
Posts: n/a
 
      11-12-2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 11 Nov 2006 11:33:48 -0800, David wrote:

> Hi,
>
> Im trying to create a custom text box. What I have done is inherited from
> the JTextField class, and attached key listeners. However, obviously swing
> is calling my listeners then processing the JTextFields ones. Without
> using the formatter etc... I want to block key events from being processed
> by JTextField. Any ideas how I can achieve this? Ive tried looking at the
> source, but just cant seem to find any way to do this apart from
> Key-Binding every key on the keyboard, which seems insane. Im sure theres
> something easy im missing.


On a related topic, I would like to move some spell checking code from a
class I have now into a SpellCheckedTextArea, so some pointers on how best
to subclass a TextArea would also be helpful. Pointers to good references
would work as well.

Thanks.

- --
Kenneth P. Turvey <(E-Mail Removed)>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFFVpmai2ZgbrTULjoRAr21AJkBOC6TmDEnTSf+G5Rf+k K4rlbAqACfR/AH
6VfvZWZeFoADuCMVVvJvluE=
=pEx/
-----END PGP SIGNATURE-----

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Swing: align JLabel, JTextField inside TitledBorder albert kao Java 15 03-12-2011 11:37 PM
java swing jtextfield modifiying input brf Java 2 12-04-2006 04:54 PM
HEXUS.guide: Customising Google News Silverstrand Front Page News 0 08-03-2005 11:25 PM
Can I use a swing Component (e.g. JTextField) in a Java Applet Prashanth Ravi Java 2 10-07-2004 09:58 AM
Can I use a swing Component (e.g. JTextField) in a Java Applet Prashanth Ravi Java 1 10-07-2004 09:30 AM



Advertisments