🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTextField validation

#11698
From: Jason Burton
Date: Tue, 20 Apr 1999 00:00
15 lines
1467 bytes
> If you get a focus lost event, note that you *ALREADY* lost focus.  Focus
> is *GONE*.  Another component *ALREADY* has the focus.  To move focus
> back, the new component gets a focus lost event.  Will you then validate
> the new component as well losing focus back to the original?
> See how complicated all this is?  I personally highly advise *AGAINST*
> doing things on a focus lost.  One good way to do validation is on each
> keystroke by writing your own Document.  It's quite easy.

A simple "user changed field" flag can be used to determine whether or not
to perform validation.  This will prevent validation from occuring in the
newly focused field when it is determined that the input in the last field
is invalid.  Validating on key strokes can be a bad choice for things like
database lookups based on current field value.

Jason Burton
Technical Details
Message-ID: <7fi16l$1kh12@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7fg4uv$suv26@forums.borland.com> <MPG.1185a5346cbef1cf9896d7@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,816558d5accb6dda
X-Google-Attributes: gid111d45,public
From: "Jason Burton" <Jason.Burton@McLeodSoftware.com>
Subject: Re: JTextField validation
Date: 1999/04/20
Message-ID: <7fi16l$1kh12@forums.borland.com>
X-Deja-AN: 468719518
References: <7fg4uv$suv26@forums.borland.com> <MPG.1185a5346cbef1cf9896d7@forums.borland.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing